I have a ruby app and it makes a connection to SQL server (works fine) and Postgres (breaking). I don't know how to debug this. I tried connecting to the postgres database from the command line and it worked (without a password actually).
It throws a ActiveRecord::ConnectionNotEstablished error on the first line:
nti_shipment.line_items.each_with_index do |nti_line_item,i|
#logger.info "\n\nadd line item to shipto: "+nti_line_item.botcode+"****"
product = Web::Product.find_by_nti_product_id(nti_line_item.botcode)
#is_message = (i > 0 && (not product)) ? true : false
is_message = (nti_line_item.productid == 0) ? true : false
if !(is_message)
web_line_item = web_shipment.add_line_item(nti_line_item)
last_item = web_line_item
nti_line_item.itemid = web_line_item.id
nti_line_item.save!
elsif i > 0
last_item.line_item_messages << Web::LineItemMessage.add(last_item,nti_line_item)
end
end
And this is the database.yml file I'm using:
production:
adapter: postgresql
database: mysite_production
username: myuser
password: "password"
options: "-o sslmode=require"
host: localhost
This is the full trace:
I, [2013-10-03T10:24:45.034384 #16480] INFO -- : ActiveRecord::ConnectionNotEstablished
I, [2013-10-03T10:24:45.105416 #16480] INFO -- : /usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-sqlserver-adapter-3.2.12/lib/arel/visitors/sqlserver.rb:81:in `engine_activerecord_sqlserver_adapter?'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-sqlserver-adapter-3.2.12/lib/arel/visitors/sqlserver.rb:33:in `order'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/relation/query_methods.rb:279:in `build_arel'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/relation/query_methods.rb:260:in `arel'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/relation.rb:171:in `exec_queries'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/relation.rb:160:in `block in to_a'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/explain.rb:41:in `logging_query_plan'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/relation.rb:159:in `to_a'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/relation/finder_methods.rb:159:in `all'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/associations/collection_association.rb:382:in `find_target'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/associations/collection_association.rb:335:in `load_target'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/associations/collection_proxy.rb:44:in `load_target'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/associations/collection_proxy.rb:87:in `method_missing'
/usr/local/sl-exchange/app/controllers/order_controller.rb:219:in `block (4 levels) in create_web_orders'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/associations/collection_proxy.rb:89:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/associations/collection_proxy.rb:89:in `method_missing'
/usr/local/sl-exchange/app/controllers/order_controller.rb:194:in `block (3 levels) in create_web_orders'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-sqlserver-adapter-3.2.12/lib/active_record/connection_adapters/sqlserver/database_statements.rb:52:in `block in transaction'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-sqlserver-adapter-3.2.12/lib/active_record/connection_adapters/sqlserver/core_ext/database_statements.rb:37:in `transaction_with_retry_deadlock_victim'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-sqlserver-adapter-3.2.12/lib/active_record/connection_adapters/sqlserver/database_statements.rb:52:in `transaction'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
/usr/local/sl-exchange/app/controllers/order_controller.rb:167:in `block (2 levels) in create_web_orders'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.14/lib/active_record/transactions.rb:208:in `transaction'
/usr/local/sl-exchange/app/controllers/order_controller.rb:166:in `block in create_web_orders'
/usr/local/sl-exchange/app/controllers/order_controller.rb:164:in `each'
/usr/local/sl-exchange/app/controllers/order_controller.rb:164:in `create_web_orders'
/usr/local/sl-exchange/app/controllers/order_controller.rb:28:in `start'
/usr/local/sl-exchange/lib/exchange.rb:115:in `initialize'
/usr/local/sl-exchange/lib/exchange.rb:194:in `new'
/usr/local/sl-exchange/lib/exchange.rb:194:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/daemons-1.1.9/lib/daemons/application.rb:203:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/daemons-1.1.9/lib/daemons/application.rb:203:in `start_load'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/daemons-1.1.9/lib/daemons/application.rb:298:in `start'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/daemons-1.1.9/lib/daemons/controller.rb:70:in `run'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/daemons-1.1.9/lib/daemons.rb:147:in `block in run'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `catch_exceptions'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/daemons-1.1.9/lib/daemons.rb:146:in `run'
Here are my gems:
** LOCAL GEMS ***
activemodel (3.2.14)
activerecord (3.2.14)
activerecord-postgresql-adapter (0.0.1)
activerecord-sqlserver-adapter (3.2.12)
activesupport (3.2.14)
arel (3.0.2)
bigdecimal (1.1.0)
builder (3.0.4)
bundler (1.3.5)
bundler-unload (1.0.1)
daemons (1.1.9)
i18n (0.6.5)
io-console (0.3)
json (1.5.5)
mailfactory (1.4.0)
mime-types (1.24)
mini_portile (0.5.1)
minitest (2.5.1)
multi_json (1.7.9)
nokogiri (1.6.0)
pg (0.15.1)
rake (10.1.0, 0.9.2.2)
rchardet (1.3.1)
rdoc (3.9.5)
RedCloth (4.2.9)
rubygems-bundler (1.2.2)
rvm (1.11.3.8)
sanitize (2.0.6)
tiny_tds (0.6.1)
tzinfo (0.3.37)
Let me know if you need more info.
===== SQLSERVER CONFIG =====
production:
adapter: sqlserver
host: cluster.mysite.com
database: mydb
#dsn: preview
username: myuser
password: mypwd
port: 1433
when I try telnet cluster.mysite.com 1433 it works... so I don't know what's going on.
Your configuration in database.yml says postgresql, but, your error trace has activerecord-sqlserver-adapter-3.2.12 in it. So, looks like, still you are trying to connect to sqlserver.So, it is not postgres breaking, it is sqlserver breaking.
Related
Recently I upgraded less-rails gem to 3.0.0. The error raised on stylesheet_link_tag, javascript_include_tag, image_tag and anywhere else that involving asset pipeline.
However when I prepend /assets/ e.g change from
= stylesheet_link_tag "application" to = stylesheet_link_tag "/assets/application" it works.
Error trace:
less (2.6.0) lib/less/parser.rb:74:in `block (2 levels) in parse'
at Parser.parser.parse (less (2.6.0) lib/less/js/lib/less/parser.js:511:24)
less (2.6.0) lib/less/parser.rb:64:in `block in parse'
less (2.6.0) lib/less/java_script/v8_context.rb:90:in `block in do_lock'
less (2.6.0) lib/less/java_script/v8_context.rb:88:in `Locker'
less (2.6.0) lib/less/java_script/v8_context.rb:88:in `do_lock'
less (2.6.0) lib/less/java_script/v8_context.rb:60:in `lock'
less (2.6.0) lib/less/java_script/v8_context.rb:30:in `exec'
less (2.6.0) lib/less/java_script.rb:26:in `exec'
less (2.6.0) lib/less/parser.rb:63:in `parse'
less-rails (3.0.0) lib/less/rails/template_handlers.rb:18:in `evaluate'
tilt (2.0.8) lib/tilt/template.rb:109:in `render'
grease (0.3.1) lib/grease/adapter.rb:12:in `call'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:75:in `call_processor'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:57:in `block in call_processors'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:56:in `reverse_each'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:56:in `call_processors'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:75:in `call_processor'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:57:in `block in call_processors'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:56:in `reverse_each'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:56:in `call_processors'
sprockets (3.7.1) lib/sprockets/loader.rb:134:in `load_from_unloaded'
sprockets (3.7.1) lib/sprockets/loader.rb:60:in `block in load'
sprockets (3.7.1) lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
sprockets (3.7.1) lib/sprockets/loader.rb:44:in `load'
sprockets (3.7.1) lib/sprockets/cached_environment.rb:20:in `block in initialize'
sprockets (3.7.1) lib/sprockets/cached_environment.rb:47:in `load'
sprockets (3.7.1) lib/sprockets/bundle.rb:23:in `block in call'
sprockets (3.7.1) lib/sprockets/utils.rb:200:in `dfs'
sprockets (3.7.1) lib/sprockets/bundle.rb:24:in `call'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:75:in `call_processor'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:57:in `block in call_processors'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:56:in `reverse_each'
sprockets (3.7.1) lib/sprockets/processor_utils.rb:56:in `call_processors'
sprockets (3.7.1) lib/sprockets/loader.rb:134:in `load_from_unloaded'
sprockets (3.7.1) lib/sprockets/loader.rb:60:in `block in load'
sprockets (3.7.1) lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
sprockets (3.7.1) lib/sprockets/loader.rb:44:in `load'
sprockets (3.7.1) lib/sprockets/cached_environment.rb:20:in `block in initialize'
sprockets (3.7.1) lib/sprockets/cached_environment.rb:47:in `load'
sprockets (3.7.1) lib/sprockets/base.rb:66:in `find_asset'
sprockets (3.7.1) lib/sprockets/base.rb:73:in `find_all_linked_assets'
sprockets (3.7.1) lib/sprockets/manifest.rb:134:in `block in find'
sprockets (3.7.1) lib/sprockets/manifest.rb:133:in `each'
sprockets (3.7.1) lib/sprockets/manifest.rb:133:in `find'
sprockets-rails (3.2.1) lib/sprockets/railtie.rb:50:in `each'
sprockets-rails (3.2.1) lib/sprockets/railtie.rb:50:in `map'
sprockets-rails (3.2.1) lib/sprockets/railtie.rb:50:in `precompiled_assets'
sprockets-rails (3.2.1) lib/sprockets/railtie.rb:35:in `asset_precompiled?'
sprockets-rails (3.2.1) lib/sprockets/railtie.rb:251:in `block (3 levels) in <class:Railtie>'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:359:in `precompiled?'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:363:in `raise_unless_precompiled_asset'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:337:in `digest_path'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:325:in `asset_path'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:102:in `block in resolve_asset_path'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:242:in `block in resolve_asset'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:241:in `each'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:241:in `detect'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:241:in `resolve_asset'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:101:in `resolve_asset_path'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:79:in `compute_asset_path'
actionview (5.0.2) lib/action_view/helpers/asset_url_helper.rb:144:in `asset_path'
actionview (5.0.2) lib/action_view/helpers/asset_url_helper.rb:254:in `javascript_path'
actionview (5.0.2) lib/action_view/helpers/asset_tag_helper.rb:61:in `block in javascript_include_tag'
actionview (5.0.2) lib/action_view/helpers/asset_tag_helper.rb:59:in `map'
actionview (5.0.2) lib/action_view/helpers/asset_tag_helper.rb:59:in `javascript_include_tag'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:156:in `block in javascript_include_tag'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:154:in `map'
sprockets-rails (3.2.1) lib/sprockets/rails/helper.rb:154:in `javascript_include_tag'
app/views/layouts/application.html.haml:185:in `_app_views_layouts_application_html_haml__1636334633396439568_70098641364520'
I tried removing one by one css and js file but it seems the issue are not with the files. Any idea?
Here is the output when I run Rails.application.config.assets.paths (file paths are ommited) :
["/path/to/rails-project/app/assets/fonts", "/path/to/rails-project/app/assets/images", "/path/to/rails-project/app/assets/javascripts", "/path/to/rails-project/app/assets/stylesheets", "/path/to/rails-project/vendor/assets/javascripts", "/path/to/rails-project/vendor/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails-assets-jcrop-0.9.12/app/assets/images", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails-assets-jcrop-0.9.12/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails-assets-jcrop-0.9.12/app/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails-assets-jcrop-0.9.12/app/assets/templates", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails-assets-Sortable-1.4.2/app/assets/images", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails-assets-Sortable-1.4.2/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails-assets-Sortable-1.4.2/app/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails-assets-Sortable-1.4.2/app/assets/templates", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails-assets-react-bootstrap-0.28.1/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails-assets-react-0.14.3/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails-assets-classnames-2.2.0/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/activeadmin-1.0.0/app/assets/images", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/activeadmin-1.0.0/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/activeadmin-1.0.0/app/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/jquery-ui-rails-6.0.1/app/assets/images", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/jquery-ui-rails-6.0.1/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/jquery-ui-rails-6.0.1/app/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/bourbon-4.3.4/app/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/s3_file_field-1.3.0/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/s3_direct_upload-0.1.7/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/s3_direct_upload-0.1.7/app/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/jquery-fileupload-rails-0.4.1/vendor/assets/images", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/jquery-fileupload-rails-0.4.1/vendor/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/jquery-fileupload-rails-0.4.1/vendor/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/browser-timezone-rails-1.0.1/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/jstz-rails3-plus-1.0.5/vendor/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/js_cookie_rails-2.1.4/vendor/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/browser-timezone-rails-1.0.1/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/bootstrap3-datetimepicker-rails-4.17.37/vendor/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/bootstrap3-datetimepicker-rails-4.17.37/vendor/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/momentjs-rails-2.11.0/vendor/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/bootstrap-datepicker-rails-1.3.0.2/vendor/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/bootstrap-datepicker-rails-1.3.0.2/vendor/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/bundler/gems/surveyor-9563ce853417/lib/assets/fonts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/bundler/gems/surveyor-9563ce853417/lib/assets/images", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/bundler/gems/surveyor-9563ce853417/lib/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/bundler/gems/surveyor-9563ce853417/lib/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/turboboost-0.1.1/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/jquery-turbolinks-2.1.0/vendor/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/formtastic-3.1.5/app/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/rails3-jquery-autocomplete-1.0.14/lib/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/cocoon-1.2.6/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/jqcloud-rails-1.0.0/vendor/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/jqcloud-rails-1.0.0/vendor/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/pickadate-rails-1.5.0/vendor/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/pickadate-rails-1.5.0/vendor/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/bootstrap-slider-rails-9.8.0/vendor/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/bootstrap-slider-rails-9.8.0/vendor/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/twitter-bootstrap-rails-3.2.2/app/assets/fonts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/twitter-bootstrap-rails-3.2.2/app/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/twitter-bootstrap-rails-3.2.2/app/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/twitter-bootstrap-rails-3.2.2/vendor/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/font-awesome-rails-4.7.0.2/app/assets/fonts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/font-awesome-rails-4.7.0.2/app/assets/stylesheets", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/jquery-rails-4.3.1/vendor/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/coffee-rails-4.2.2/lib/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/actioncable-5.0.2/lib/assets/compiled", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/turbolinks-source-5.0.3/lib/assets/javascripts", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/react-rails-2.2.1/lib/assets/react-source/development-with-addons", "/Users/my-username/.rvm/gems/ruby-2.4.2#gemset-name/gems/react-rails-2.2.1/lib/assets/javascripts/"]
Am installing fedena on windows 10. My ruby version is 1.9.3 and gem version is 1.8.29 and rails version 2.3.5. When I run the command it gives out the following output. Am new to Ruby any suggestions as to how I can solve this?
C:\fedena>rake db:create
rake aborted!
Could not find test-unit (= 1.2.3) amongst [actionmailer-2.3.5, actionpack-2.3.5, activerecord-2.3.5, activeresource-2.3
.5, activesupport-2.3.5, bigdecimal-1.1.0, i18n-0.4.0, io-console-0.3, json-1.5.5, minitest-2.5.1, mysql-2.9.1-x86-mingw
32, prawn-0.6.3, prawn-core-0.6.3, prawn-format-0.2.3, prawn-layout-0.3.2, prawn-security-0.1.1, rack-1.0.1, rails-2.3.5
, rake-0.9.2.2, rdoc-4.2.2, rdoc-3.9.5, rubytest-0.8.1, test-1.0.0]
(See full trace by running task with --trace)
C:\fedena>rake db:create --trace
rake aborted!
Could not find test-unit (= 1.2.3) amongst [actionmailer-2.3.5, actionpack-2.3.5, activerecord-2.3.5, activeresource-2.3
.5, activesupport-2.3.5, bigdecimal-1.1.0, i18n-0.4.0, io-console-0.3, json-1.5.5, minitest-2.5.1, mysql-2.9.1-x86-mingw
32, prawn-0.6.3, prawn-core-0.6.3, prawn-format-0.2.3, prawn-layout-0.3.2, prawn-security-0.1.1, rack-1.0.1, rails-2.3.5
, rake-0.9.2.2, rdoc-4.2.2, rdoc-3.9.5]
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
C:/fedena/lib/tasks/rspec.rake:1:in `<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `block in load_with_ne
w_constant_marking'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load_with_new_constan
t_marking'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/tasks/rails.rb:9:in `block in <top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/tasks/rails.rb:9:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/tasks/rails.rb:9:in `<top (required)>'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
C:/fedena/Rakefile:10:in `<top (required)>'
C:/Ruby193/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load'
C:/Ruby193/lib/ruby/1.9.1/rake/rake_module.rb:25:in `load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:501:in `raw_load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:82:in `block in load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:81:in `load_rakefile'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:65:in `block in run'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
C:/Ruby193/lib/ruby/1.9.1/rake/application.rb:63:in `run'
C:/Ruby193/bin/rake:32:in `<main>'
The application you are trying install is written in ruby 1.8.7 and you are trying to run on ruby 1.9
Use this guide for installing fedena
UPDATE --
I would recommend skipping direct to answer section -- goal of this was to allow multiple subdomains, each of which would have their own users/registrants. A registrant could register on multiple subdomains, however each subdomain is treated independently and unassociated with the others.
I feel this questions is still in need of a better answer so please contribute to it.
===============
ORIGINAL POST --
Help please --
scenario --
My site is used by :teams, each of which has :users. Im trying to enable :users to log in via the :team subdomain. (unique USER index keys are :email and :team_id -- the subdomain is part of a separate TEAM model that im trying to associate by :team_id in the user model during signin.)
TEAM MODEL
has_many :users
USER MODEL
devise request_keys: [:team_id]
belongs_to :team
def self.find_for_authentication(warden_conditions)
where(:email => warden_conditions[:email], :team_id => warden_conditions[:team_id]).first
end
this is per the new instruction on devise wiki: https://github.com/plataformatec/devise/wiki/How-to:-Scope-login-to-subdomain
APPLICATION CONTROLLER
I use before_action to set the team based on subdomain
I also add the strong params the "lazy" way for team_id / devise_parameter_sanitizer.for(:sign_in) << :team_id
DEVISE SESSIONS NEW VIEW (For USERS)
I feel dirty doing this, but I have a hidden team_id input field
AND THE ERROR DUMP NoMethodError undefined method team_id
Started POST "/users/sign_in" for 111.0.0.1 at 2013-09-13 13:08:09 -0400
Processing by Devise::SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"LONG TOKEN HERE=", "user"=>{"email"=>"user#site.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "team_id"=>"16", "commit"=>"Sign in"}
[1m[35mTeam Load (0.2ms)[0m SELECT "teams".* FROM "teams" WHERE "teams"."subdomain" = 'teamname' LIMIT 1
Completed 500 Internal Server Error in 119ms
NoMethodError (undefined method `team_id' for #<ActionDispatch::Request:0x007ffe950c2150>):
devise (3.1.0) lib/devise/strategies/authenticatable.rb:142:in `block in request_values'
devise (3.1.0) lib/devise/strategies/authenticatable.rb:142:in `map'
devise (3.1.0) lib/devise/strategies/authenticatable.rb:142:in `request_values'
devise (3.1.0) lib/devise/strategies/authenticatable.rb:122:in `with_authentication_hash'
devise (3.1.0) lib/devise/strategies/authenticatable.rb:71:in `valid_for_params_auth?'
devise (3.1.0) lib/devise/strategies/authenticatable.rb:16:in `valid?'
warden (1.2.3) lib/warden/proxy.rb:351:in `block in _run_strategies_for'
warden (1.2.3) lib/warden/proxy.rb:349:in `each'
warden (1.2.3) lib/warden/proxy.rb:349:in `_run_strategies_for'
warden (1.2.3) lib/warden/proxy.rb:319:in `_perform_authentication'
warden (1.2.3) lib/warden/proxy.rb:127:in `authenticate!'
devise (3.1.0) app/controllers/devise/sessions_controller.rb:15:in `create'
actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.0) lib/active_support/callbacks.rb:463:in `_run__412684316733059520__process_action__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/mapper.rb:44:in `call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:35:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__1066722413265567725__call__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0) lib/rails/engine.rb:511:in `call'
railties (4.0.0) lib/rails/application.rb:97:in `call'
/Users/Home/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:145:in `handle'
/Users/Home/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:99:in `rescue in block (2 levels) in start'
/Users/Home/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:96:in `block (2 levels) in start'
/Users/Home/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:86:in `each'
/Users/Home/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:86:in `block in start'
/Users/Home/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:66:in `loop'
/Users/Home/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:66:in `start'
/Users/Home/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:13:in `run'
/Users/Home/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/bin/nack_worker:4:in `<main>'
Help is much appreciated. Thanks!
Here is how i resolved --
I followed the instructions here exactly: https://github.com/plataformatec/devise/wiki/How-to:-Scope-login-to-subdomain
To use these instructions i added the subdomain column to the users table (creating a lot of duplicate subdomains since each team has_many users).
Then in my Team controller when i update a team subdomain it also creates a query to gather all the users associated with the team to update their subdomain values as well. Not the ideal fix but works well enough.
UPDATE
I hope someone finds a better way -- in mean time i'll make a small addition to this. in order for the same email to work across multiple subdomains you need to add the below in your user model. Otherwise the same email will only be registered for 1 subdomain and any registrations on other subdomains will give you the email is already registered error.
validates_uniqueness_of :email, :scope => :subdomain
For this to work you need to remove :validatable from the devise options in your user model and create your own custom validations for email and passwords.
It's not necessary to add column "subdomain" in DB-table. For example in my case I need provide authentication from "www" only for clients, and from "account" only for partners.
def self.find_for_authentication(conditions)
subdomain = conditions.delete(:subdomain)
if user = super
case subdomain
when 'www'
user.client? ? user : nil
when 'account'
user.partner? ? user : nil
else
nil
end
end
end
I guess this approach more simple.
I believe this is actually a bug related to a change in the way ActionDispatch::Request works.
Devise seems to be assuming that if it calls a key on the request hash it will get nil if the value doesn't exist and will get the value otherwise.
It attempts to access the request with .send which doesn't seem to work in the current version of rails. If you patch devise like so:
diff --git a/lib/devise/strategies/authenticatable.rb b/lib/devise/strategies/authenticatable.rb
index 13249e8..df28fc9 100644
--- a/lib/devise/strategies/authenticatable.rb
+++ b/lib/devise/strategies/authenticatable.rb
## -148,7 +148,7 ## module Devise
def request_values
keys = request_keys.respond_to?(:keys) ? request_keys.keys : request_keys
- values = keys.map { |k| self.request.send(k) }
+ values = keys.map { |k| self.request[k] }
Hash[keys.zip(values)]
end
it seems to work fine.
Edit: I wrote up a partial patch with a few more details here:
https://github.com/plataformatec/devise/pull/3965
I am having an issue were I keep getting this timeout for Faraday. I don't know what the issue is. I could really use some help here. This failing on a redirect. I am not sure what is causing the issue. I have been trying to fix this for 4 whole days and nothing seems to work. There is very little documentation on Faraday so I am hoping that someone has seen this before.
Is anyone able to help with this error? Is more information needed?
Faraday::Error::TimeoutError (Timeout::Error):
/usr/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill'
/usr/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
/usr/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
/usr/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
/usr/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
/usr/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
/usr/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
/usr/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
/usr/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
/usr/lib/ruby/1.9.1/net/http.rb:1293:in `request'
rest-client (1.6.7) lib/restclient/net_http_ext.rb:51:in `request'
/usr/lib/ruby/1.9.1/net/http.rb:1286:in `block in request'
/usr/lib/ruby/1.9.1/net/http.rb:745:in `start'
/usr/lib/ruby/1.9.1/net/http.rb:1284:in `request'
rest-client (1.6.7) lib/restclient/net_http_ext.rb:51:in `request'
faraday (0.8.4) lib/faraday/adapter/net_http.rb:74:in `perform_request'
faraday (0.8.4) lib/faraday/adapter/net_http.rb:37:in `call'
faraday (0.8.4) lib/faraday/request/url_encoded.rb:14:in `call'
faraday (0.8.4) lib/faraday/connection.rb:226:in `run_request'
oauth2 (0.8.0) lib/oauth2/client.rb:88:in `request'
oauth2 (0.8.0) lib/oauth2/client.rb:131:in `get_token'
oauth2 (0.8.0) lib/oauth2/strategy/auth_code.rb:29:in `get_token'
omniauth-oauth2 (1.1.0) lib/omniauth/strategies/oauth2.rb:100:in `build_access_token'
omniauth-oauth2 (1.1.0) lib/omniauth/strategies/oauth2.rb:75:in `callback_phase'
omniauth (1.1.1) lib/omniauth/strategy.rb:219:in `callback_call'
omniauth (1.1.1) lib/omniauth/strategy.rb:175:in `call!'
omniauth (1.1.1) lib/omniauth/strategy.rb:157:in `call'
omniauth (1.1.1) lib/omniauth/strategy.rb:177:in `call!'
omniauth (1.1.1) lib/omniauth/strategy.rb:157:in `call'
airbrake (3.1.7) lib/airbrake/rails/middleware.rb:15:in `call'
exception_notification (2.6.1) lib/exception_notifier.rb:34:in `call'
warden (1.2.1) lib/warden/manager.rb:35:in `block in call'
warden (1.2.1) lib/warden/manager.rb:34:in `catch'
warden (1.2.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/head.rb:14:in `call'
remotipart (1.0.5) lib/remotipart/middleware.rb:30:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.11) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `_run__2705598145907853404__call__3655850838898635033__callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.11) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.11) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.11) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.11) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.11) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
airbrake (3.1.7) lib/airbrake/user_informer.rb:16:in `_call'
airbrake (3.1.7) lib/airbrake/user_informer.rb:12:in `call'
railties (3.2.11) lib/rails/engine.rb:479:in `call'
railties (3.2.11) lib/rails/application.rb:223:in `call'
railties (3.2.11) lib/rails/railtie/configurable.rb:30:in `method_missing'
/usr/lib/ruby/1.9.1/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/usr/lib/ruby/1.9.1/phusion_passenger/abstract_request_handler.rb:516:in `accept_and_process_next_request'
/usr/lib/ruby/1.9.1/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/usr/lib/ruby/1.9.1/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
/usr/lib/ruby/1.9.1/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
/usr/lib/ruby/1.9.1/phusion_passenger/utils.rb:470:in `safe_fork'
/usr/lib/ruby/1.9.1/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
/usr/lib/ruby/1.9.1/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/lib/ruby/1.9.1/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/lib/ruby/1.9.1/phusion_passenger/abstract_server.rb:180:in `start'
/usr/lib/ruby/1.9.1/phusion_passenger/rack/application_spawner.rb:129:in `start'
/usr/lib/ruby/1.9.1/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
/usr/lib/ruby/1.9.1/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/usr/lib/ruby/1.9.1/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
/usr/lib/ruby/1.9.1/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
/usr/lib/ruby/1.9.1/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/usr/lib/ruby/1.9.1/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
/usr/lib/ruby/1.9.1/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
/usr/lib/ruby/1.9.1/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/usr/lib/ruby/1.9.1/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/usr/lib/ruby/1.9.1/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/usr/share/phusion-passenger/helper-scripts/passenger-spawn-server:99:in `<main>'
If you need more information on what's happening, you can make faraday log to stdout, which means you can see what's happening and what http calls are being made. The error is happening with OAuth2, so you need to look into why it's timing out.
I'd recommend you run this on your repo:
bundle install --path vendor/bundle
Then, go into the vendor/bundle folder, into the oauth2 folder, and add the line
connection.response :logger if ENV['DEBUG']
to client.rb, within the def request(verb, url, opts={}) method.
Then, whatever command you are using to run phusion-passenger add DEBUG=true to the start of it.
Long answer I know, but should help diagnose what the faraday issue is!
I want to verify if a user exists, and if so, do a password match.
My controller looks like this:
def attempt_login
authorized_user = User.authenticate(params[:username], params[:password])
if authorized_user
flash[:notice] = "Successfully logged in."
redirect_to(:action => 'menu')
else
flash[:notice] = "Invalid username/password"
redirect_to(:action => 'login')
end
end
The model looks like:
def self.authenticate(username="", password="")
user = User.find_by_username(username)
if user && user.password_match?(password)
return user
else
return false
end
end
def password_match?(password="")
hashed_password == User.hash_with_salt(password,salt)
end
In the process of doing this, I receive the TypeError (Can't convert String into Integer). I suspect the error occurs when I want to set a value for authorized_user, but do not know how to approach this issue.
Edit:
My server log is empty. But I can post the Framework Trace:
activesupport (3.0.8) lib/active_support/descendants_tracker.rb:23:in `delete'
activesupport (3.0.8) lib/active_support/descendants_tracker.rb:23:in `block in clear'
activesupport (3.0.8) lib/active_support/descendants_tracker.rb:21:in `each'
activesupport (3.0.8) lib/active_support/descendants_tracker.rb:21:in `clear'
railties (3.0.8) lib/rails/application/bootstrap.rb:59:in `block (2 levels) in <module:Bootstrap>'
activesupport (3.0.8) lib/active_support/callbacks.rb:420:in `_run_call_callbacks'
actionpack (3.0.8) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.3) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.8) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.3) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.3) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.3) lib/rack/lock.rb:11:in `call'
actionpack (3.0.8) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.8) lib/rails/application.rb:168:in `call'
railties (3.0.8) lib/rails/application.rb:77:in `method_missing'
railties (3.0.8) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.3) lib/rack/content_length.rb:13:in `call'
rack (1.2.3) lib/rack/handler/webrick.rb:52:in `service'
E:/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
E:/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
E:/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
And here is the development.log if it could help:
Started POST "/access/attempt_login" for 127.0.0.1 at 2011-06-27 20:19:19 +0200
DEPRECATION WARNING: config.action_view.debug_rjs will be removed in 3.1, from 3.1 onwards you will need to install prototype-rails to continue to use RJS templates . (called from <top (required)> at G:/Projects/basicsocial/app/controllers/application_controller.rb:1)
Processing by AccessController#attempt_login as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"jvGVYJEypK9sWoaaa5c2OwzBKmCMX7h7Wp28vBH9wfw=", "username"=>"test88", "password"=>"[FILTERED]", "commit"=>"Log In"}
<-[1m<-[36mSQL (7.0ms)<-[0m <-[1mdescribe `users_pages`<-[0m
<-[1m<-[35mSQL (2.0ms)<-[0m SHOW TABLES
<-[1m<-[36mUser Load (0.0ms)<-[0m <-[1mSELECT `users`.* FROM `users` WHERE `users`.`username` = 'test88' LIMIT 1<-[0m
Redirected to http://localhost:3000/admin
Completed 302 Found in 545ms
TypeError (can't convert String into Integer):
Rendered E:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered E:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (5.0ms)
Rendered E:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.8/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (16.0ms)
The salt variable is what I use to better secure my user's page. This is something that is stored in the database.
Apparently there was nothing wrong with the code. It was probably related to my browsers cache or something of that nature, as it started working the next day. Sorry for the inconvenience.
I had this same problem and spent hours trying to fix it. It turned out that I had left in a method that the tutorial had told me to delete a few videos beforehand:
def self.hash(password="")
Digest::SHA1.hexdigest(password)
end
In the tutorial, this had been replaced by the methods
def self.make_salt(username="")
Digest::SHA1.hexdigest("Use #{username} with #{Time.now} to make salt")
end
def self.hash_with_salt(password="", salt="")
Digest::SHA1.hexdigest("Put #{salt} on the #{password}")
end
Once I commented this method out, the error went away. I still don't understand why that error showed up in the first place. I added a question and more detail here.
Just want to let you know that i had this problem as well.
The issue was quickly solved but the server showed the error every request afterwards.
Code changes have not been reflected until i restarted the server.
touch tmp/restart.txt was not sufficient so i had to restart the server /etc/init.d/apache2 restart to remove the error message.
$ apache2 -v
Server version: Apache/2.2.16 (Debian)
Server built: Apr 1 2012 07:14:38
$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
$ gem list passenger
*** LOCAL GEMS ***
passenger (3.0.13)
$ bundle exec rails -v
Rails 3.0.7