Rails: Secret Token Error - ruby-on-rails

I am using Rails 3.2.13 and get the following message:
ArgumentError (A secret is required to generate an integrity hash for cookie session data. Use config.secret_token = "some secret phrase of at least 30 characters"in config/initializers/secret_token.rb):
I've found reference to this in this pull request and a discussion here.
I am using Devise (hence, Warden) and the info in the discussion is relevant. I'd prefer not to hack on the railtie gem -- what is the recommended action here?
Thanks
Stack trace:
Connecting to database specified by database.yml
Started GET "/" for 76.176.151.243 at 2013-07-20 12:34:25 -0700
ArgumentError (A secret is required to generate an integrity hash for cookie session data. Use config.secret_token = "some secret phrase of at least 30 characters"in config/initializers/secret_token.rb):
actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:319:in `ensure_secret_secure'
actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:284:in `initialize'
actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:231:in `new'
actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:231:in `signed'
actionpack (3.2.13) lib/action_dispatch/middleware/session/cookie_store.rb:50:in `block in unpacked_cookie_data'
actionpack (3.2.13) lib/action_dispatch/middleware/session/abstract_store.rb:57:in `stale_session_check!'
actionpack (3.2.13) lib/action_dispatch/middleware/session/cookie_store.rb:48:in `unpacked_cookie_data'
rack (1.4.5) lib/rack/session/cookie.rb:107:in `extract_session_id'
actionpack (3.2.13) lib/action_dispatch/middleware/session/abstract_store.rb:53:in `block in extract_session_id'
actionpack (3.2.13) lib/action_dispatch/middleware/session/abstract_store.rb:57:in `stale_session_check!'
actionpack (3.2.13) lib/action_dispatch/middleware/session/abstract_store.rb:53:in `extract_session_id'
rack (1.4.5) lib/rack/session/abstract/id.rb:43:in `load_session_id!'
rack (1.4.5) lib/rack/session/abstract/id.rb:32:in `[]'
rack (1.4.5) lib/rack/session/abstract/id.rb:267:in `current_session_id'
rack (1.4.5) lib/rack/session/abstract/id.rb:273:in `session_exists?'
rack (1.4.5) lib/rack/session/abstract/id.rb:107:in `exists?'
rack (1.4.5) lib/rack/session/abstract/id.rb:127:in `load_for_read!'
rack (1.4.5) lib/rack/session/abstract/id.rb:64:in `has_key?'
actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:258:in `ensure in call'
actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:259: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.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__1076913542946280817__call__830910935667466127__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
rack (1.4.5) lib/rack/sendfile.rb:102:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.13) 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'
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'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/application.rb:223:in `call'
railties (3.2.13) lib/rails/railtie/configurable.rb:30:in `method_missing'
passenger (4.0.8) lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
passenger (4.0.8) lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
passenger (4.0.8) lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
passenger (4.0.8) lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'

In my config/initializers/secret_token.rb I have following
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Friendflat::Application.config.secret_token = 'asdf...'
You should add the same, setting value to some long random hex string.

Related

Errbit LDAP Authentication not working

I'm trying to install errbit to track bugs more easily.
I followed the Installation Instructions from:
https://github.com/errbit/errbit
and
Installed the LDAP Authentication gem:
Gemfile:
gem "devise_ldap_authenticatable", :git => "git://github.com/cschiewek/devise_ldap_authenticatable.git"
executed:
rails generate devise_ldap_authenticatable:install
So far everything went good. The Unicorn Application Server starts without any issues.
But If I login I get this message:
Problem:
Validation of User failed.
Summary:
The following errors were found: Email can't be blank, Name can't be blank
Resolution:
Try persisting the document with valid data or remove the validations.
Stack Trace:
mongoid (3.1.5) lib/mongoid/persistence.rb:335:in `fail_validate!'
mongoid (3.1.5) lib/mongoid/persistence.rb:97:in `save!'
/usr/local/lib/ruby/gems/2.1.0/bundler/gems/devise_ldap_authenticatable-350b78431dbf/lib/devise_ldap_authenticatable/model.rb:107:in `find_for_ldap_authentication'
/usr/local/lib/ruby/gems/2.1.0/bundler/gems/devise_ldap_authenticatable-350b78431dbf/lib/devise_ldap_authenticatable/strategy.rb:7:in `authenticate!'
warden (1.2.3) lib/warden/strategies/base.rb:53:in `_run!'
warden (1.2.3) lib/warden/proxy.rb:354: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:104:in `authenticate'
devise (3.1.1) lib/devise/controllers/helpers.rb:56:in `current_user'
devise (3.1.1) lib/devise/controllers/helpers.rb:52:in `user_signed_in?'
app/controllers/application_controller.rb:49:in `set_time_zone'
activesupport (3.2.18) lib/active_support/callbacks.rb:484:in `_run__372840598407275581__process_action__1401166438855027473__callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.18) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.18) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.18) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.18) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.18) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.18) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.18) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.18) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.18) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
actionpack (3.2.18) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.18) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.18) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.18) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.18) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:36:in `call'
actionpack (3.2.18) lib/action_dispatch/routing/mapper.rb:43:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:608:in `call'
rack-ssl-enforcer (0.2.6) lib/rack/ssl-enforcer.rb:51:in `call'
hoptoad_notifier (2.4.11) lib/hoptoad_notifier/rack.rb:27:in `call'
mongoid (3.1.5) lib/rack/mongoid/middleware/identity_map.rb:34:in `block in call'
mongoid (3.1.5) lib/mongoid/unit_of_work.rb:39:in `unit_of_work'
mongoid (3.1.5) lib/rack/mongoid/middleware/identity_map.rb:34: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'
actionpack (3.2.18) 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:35:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.18) 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.18) lib/action_dispatch/middleware/cookies.rb:341:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `_run__2041107628848191489__call__2819675434513924104__callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.18) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.18) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
rack (1.4.5) lib/rack/sendfile.rb:102:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.18) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.18) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.18) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.18) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.18) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.18) 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.18) 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:143:in `pass'
rack-cache (1.2) lib/rack/cache/context.rb:155:in `invalidate'
rack-cache (1.2) lib/rack/cache/context.rb:71:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
hoptoad_notifier (2.4.11) lib/hoptoad_notifier/user_informer.rb:12:in `call'
railties (3.2.18) lib/rails/engine.rb:484:in `call'
railties (3.2.18) lib/rails/application.rb:231:in `call'
railties (3.2.18) lib/rails/railtie/configurable.rb:30:in `method_missing'
rack (1.4.5) lib/rack/deflater.rb:13:in `call'
unicorn (4.6.3) lib/unicorn/http_server.rb:552:in `process_client'
unicorn (4.6.3) lib/unicorn/http_server.rb:632:in `worker_loop'
unicorn (4.6.3) lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
unicorn (4.6.3) lib/unicorn/http_server.rb:142:in `start'
unicorn (4.6.3) bin/unicorn_rails:209:in `<top (required)>'
/usr/local/bin/unicorn_rails:23:in `load'
/usr/local/bin/unicorn_rails:23:in `<main>'
Request Parameters
{"utf8"=>"✓",
"authenticity_token"=>"0000000000000000000000000000000000000000",
"user"=>{"username"=>"chris",
"password"=>"[FILTERED]",
"remember_me"=>"0"}}
What did I do wrong?
Update:
It works now so far.
But I'm still gitting one more Issue:
Mongoid::Errors::Validations (
Problem:
Validation of User failed.
Summary:
The following errors were found: Name can't be blank
Resolution:
Try persisting the document with valid data or remove the validations.):
app/controllers/application_controller.rb:48:in `set_time_zone'
I tried to remove the LDAP Validation, but that also didn't work.
sorry if this answer comes too late. Here's what I did to get a working LDAP setup.
In app/models/users.rb I added the following method:
def ldap_before_save
name = Devise::LDAP::Adapter.get_ldap_param(self.username, "givenName")
surname = Devise::LDAP::Adapter.get_ldap_param(self.username, "sn")
mail = Devise::LDAP::Adapter.get_ldap_param(self.username, "mail")
self.name = (name + surname).join ' '
self.email = mail.first
end
In config/initializers/devise.rb, set the following params
config.ldap_create_user = true
config.ldap_use_admin_to_bind = true
Create a new file config/initializers/devise_ldap.rb with the following contents:
Errbit::Config.devise_modules << :ldap_authenticatable
For more details, read https://github.com/errbit/errbit#configuring-ldap-authentication

Active admin without devise configuration on rails mountable engine

I am currently trying to install active admin on a rails mountable engine. The host application for the engine has authentication configured using devise. I have installed active admin without devise authentication using the --skip-user option [while running rake active_admin:install]. I am mounting the engine on the host application on the path /admin_app/.
When trying to access the URL:
http://localhost:3000/admin_app/admin
I am getting the following error
ActionController::RoutingError - uninitialized constant Admin::DashboardController:
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:57:in `rescue in controller'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:52:in `controller'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:32:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/railtie/configurable.rb:30:in `method_missing'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
newrelic_rpm (3.6.9.171) lib/new_relic/rack/error_collector.rb:50:in `call'
newrelic_rpm (3.6.9.171) lib/new_relic/rack/error_collector.rb:50:in `call'
newrelic_rpm (3.6.9.171) lib/new_relic/rack/agent_hooks.rb:28:in `call'
newrelic_rpm (3.6.9.171) lib/new_relic/rack/browser_monitoring.rb:23:in `call'
newrelic_rpm (3.6.9.171) lib/new_relic/rack/developer_mode.rb:42: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 `call'
actionpack (3.2.13) 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.13) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.13) 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.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__342236532__call__311563165__callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
better_errors (1.0.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (1.0.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (1.0.1) lib/better_errors/middleware.rb:56:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.13) 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.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
railties (3.2.13) lib/rails/engine.rb:479:in `call'
railties (3.2.13) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
/home/systemone/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/home/systemone/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/home/systemone/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

cas_devise single sign out doesn't work

Building a CAS client in rails 3.2, I use the gem devise with the extension devise_cas.
Everything works fine login/logout.
BUT When I try to logout directly on the cas server, using the single_sign_out system everything breaks and I have no idea how to solve my problem since it seems to me that it come from the gem I use...
Here is what I get in my logs when the cas server try to inform me about the sign out:
started POST "/UserCasAuth/service" for XX.XX.XX.XX at 2013-07-23 15:08:47 +0000
Processing by Devise::CasSessionsController#single_sign_out as HTML
Parameters: {"logoutRequest"=>"<samlp:LogoutRequest xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" ID=\"LR-47-trNqu3YBrJMM7CjeUiySDrsXAe1IrxFse1T\" Version=\"2.0\" IssueInstant=\"2013-07-23T16:58:18Z\"><saml:NameID xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\">#NOT_USED#</saml:NameID><samlp:SessionIndex>ST-55-cZPVpgtFwi5ZR5ozc52r-cas</samlp:SessionIndex></samlp:LogoutRequest>"}
Completed 500 Internal Server Error in 2ms
NoMethodError (undefined method `name' for #<ActionDispatch::Session::CookieStore:0x00000005098828>):
devise_cas_authenticatable (1.3.0) lib/devise_cas_authenticatable/single_sign_out.rb:50:in `destroy_session_by_id'
devise_cas_authenticatable (1.3.0) app/controllers/devise/cas_sessions_controller.rb:66:in `destroy_cas_session'
devise_cas_authenticatable (1.3.0) app/controllers/devise/cas_sessions_controller.rb:39:in `single_sign_out'
actionpack (3.2.12) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.12) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.12) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.12) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.12) lib/active_support/callbacks.rb:425:in `_run__3173126488054142023__process_action__3586998270345349714__callbacks'
activesupport (3.2.12) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.12) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.12) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.12) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.12) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.12) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.12) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.12) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.12) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.12) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.12) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
actionpack (3.2.12) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.12) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.12) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.12) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.12) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:36:in `call'
actionpack (3.2.12) lib/action_dispatch/routing/mapper.rb:42:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:601:in `call'
mongoid (3.1.2) lib/rack/mongoid/middleware/identity_map.rb:34:in `block in call'
mongoid (3.1.2) lib/mongoid/unit_of_work.rb:39:in `unit_of_work'
mongoid (3.1.2) lib/rack/mongoid/middleware/identity_map.rb:34:in `call'
devise_cas_authenticatable (1.3.0) lib/devise_cas_authenticatable/single_sign_out/rack.rb:11: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.12) 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:35:in `call'
actionpack (3.2.12) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.12) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.12) 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.12) lib/action_dispatch/middleware/cookies.rb:341:in `call'
actionpack (3.2.12) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.12) lib/active_support/callbacks.rb:405:in `_run__4068638674135561468__call__4242089574650609487__callbacks'
activesupport (3.2.12) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.12) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.12) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.12) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
rack (1.4.5) lib/rack/sendfile.rb:102:in `call'
actionpack (3.2.12) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.12) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.12) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.12) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.12) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.12) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.12) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.12) 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.12) 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:143:in `pass'
rack-cache (1.2) lib/rack/cache/context.rb:155:in `invalidate'
rack-cache (1.2) lib/rack/cache/context.rb:71:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
railties (3.2.12) lib/rails/engine.rb:479:in `call'
railties (3.2.12) lib/rails/application.rb:223:in `call'
railties (3.2.12) lib/rails/railtie/configurable.rb:30:in `method_missing'
unicorn (4.6.2) lib/unicorn/http_server.rb:552:in `process_client'
unicorn (4.6.2) lib/unicorn/http_server.rb:632:in `worker_loop'
unicorn (4.6.2) lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
unicorn (4.6.2) lib/unicorn/http_server.rb:142:in `start'
unicorn (4.6.2) bin/unicorn_rails:209:in `<top (required)>'
/usr/local/bin/unicorn_rails:19:in `load'
/usr/local/bin/unicorn_rails:19:in `<main>'
EDIT
So I understand the problem come from this file at line 50.
I believe none of the session managers are recognized.
I have indeed removed ActiveRecord since i'm using mongoid, as mentioned in the installation doc. So should I install another session manager or something?
Devise can still its work without it (until the single-sign-out), so I believe it shouldn't be an issue?
Ok So the solution is the following:
As I can understand from this answer on gitHub, I am using the coockieStore to store my session, which is not supported by single sign-out.
So I would need to
use the ActiveRecord session store or some other database-persistent session store
I will update my answer when I will have find out what to do from here.
EDIT
So the solution was to use redis as session store. see redis-store and redis-rails gems.

Ruby on Rails Type Error cant convert nil into hash

I started a new application with
rails new doctor
rake db:migrate
rails generate controller home index
rails generate scaffold Patient age:string city:string number:string street:string
after that i deletet the public index and changed the route to root :to => "home#index"
rake db:migrate
rails server
So my problem is that i become the error in the Browser:
Type error, cant convert nil into hash
I cant explain me, what should be wrong in my application! I hope somebody knows the answer! Thanks
rack (1.4.5) lib/rack/session/abstract/id.rb:28:in `merge!'
rack (1.4.5) lib/rack/session/abstract/id.rb:28:in `initialize'
rack (1.4.5) lib/rack/session/abstract/id.rb:242:in `new'
rack (1.4.5) lib/rack/session/abstract/id.rb:242:in `prepare_session'
rack (1.4.5) lib/rack/session/abstract/id.rb:209:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.1) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__759447931__call__819038987__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) 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.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

ArgumentError Received wrong number of arguments [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
This is pretty scary, but I've spent about a week developing an app and have just been hit with the following error when running the 'Rails S' command. My app doesn't seem to want to start up anymore.
I'm sure with the help of the wonderful Stackoverflow community we can solve this one!
Edit: Thought I would include my GitHub for good measure - https://github.com/Apane/Startupblog
ArgumentError
Received wrong number of arguments. [#<Logger:0x007fe8d56bb280
#progname="omniauth", #level=0, #default_formatter=#<Logger::Formatter:0x007fe8d56bb230
#datetime_format=nil>, #formatter=#<Logger::SimpleFormatter:0x007fe8d56bb140
#datetime_format=nil>, #logdev=#<Logger::LogDevice:0x007fe8d56bb1e0 #shift_size=nil,
#shift_age=nil, #filename=nil, #dev=#<IO:<STDOUT>>, #mutex=#
<Logger::LogDevice::LogDeviceMutex:0x007fe8d56bb1b8 #mon_owner=nil,
#mon_count=0, #mon_mutex=# <Mutex:0x007fe8d56bb168>>>>]
Full Trace:
omniauth (1.1.3) lib/omniauth/strategy.rb:136:in `initialize'
rack (1.4.5) lib/rack/builder.rb:82:in `new'
rack (1.4.5) lib/rack/builder.rb:82:in `block in use'
rack (1.4.5) lib/rack/builder.rb:130:in `[]'
rack (1.4.5) lib/rack/builder.rb:130:in `block in to_app'
rack (1.4.5) lib/rack/builder.rb:130:in `each'
rack (1.4.5) lib/rack/builder.rb:130:in `inject'
rack (1.4.5) lib/rack/builder.rb:130:in `to_app'
omniauth (1.1.3) lib/omniauth/builder.rb:48: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'
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__1918359078568265758__call__4170314405657891017__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/reloader.rb:65: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'
actionpack (3.2.11) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.11) lib/rails/engine.rb:479:in `call'
railties (3.2.11) lib/rails/application.rb:223:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.11) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Your issue is actually a syntax error and looks like it was introduced when you added omniauth to the project. On line 3 of your omniauth initializer there's a trailing comma. Get rid of that and you should be fine.

Resources