New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.1 active_record_store "domain: :all" TypeError #2483

Closed
JeanMertz opened this Issue Aug 10, 2011 · 42 comments

Comments

Projects
None yet
@JeanMertz

JeanMertz commented Aug 10, 2011

update: see the comment below for a clean 3.1 app with the same error.

See Pow issue #199

Basically I keep getting a can't convert Symbol into String error when I change the domain for session_store to :all.

@JeanMertz

This comment has been minimized.

JeanMertz commented Aug 30, 2011

From the lack of comments I presume this isn't an issue in rails. Although I am still having this issue on my app, not sure what is going on though.

I managed to work around the issue by setting the domain to .mydomain.dev, and this worked fine, until I started testing custom domains just a few minutes ago. Now I really need :all again to support custom domains and allow for flash messages cross-requests on these domains (not cross-domain), but this is when the error returns again...

My session_store.rb:

Manager::Application.config.session_store :active_record_store, key: "_manager_session", domain: :all

Here is a (cucumber/capybara test suite) backtrace, it happens in development as well:

  can't convert Symbol into String (TypeError)
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/utils.rb:190:in `+'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/utils.rb:190:in `set_cookie_header!'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/session/abstract/id.rb:323:in `set_cookie'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/session/abstract/id.rb:311:in `commit_session'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/session/abstract/id.rb:196:in `context'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/session/abstract/id.rb:190:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/actionpack-3.1.0.rc8/lib/action_dispatch/middleware/cookies.rb:326:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/activerecord-3.1.0.rc8/lib/active_record/query_cache.rb:62:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/activerecord-3.1.0.rc8/lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/actionpack-3.1.0.rc8/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/activesupport-3.1.0.rc8/lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/activesupport-3.1.0.rc8/lib/active_support/callbacks.rb:81:in `run_callbacks'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/actionpack-3.1.0.rc8/lib/action_dispatch/middleware/callbacks.rb:28:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/sendfile.rb:101:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/actionpack-3.1.0.rc8/lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/actionpack-3.1.0.rc8/lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-rails-1.0.2/lib/cucumber/rails/action_controller.rb:10:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/railties-3.1.0.rc8/lib/rails/rack/logger.rb:13:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/methodoverride.rb:24:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/runtime.rb:17:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/activesupport-3.1.0.rc8/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/lock.rb:15:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/actionpack-3.1.0.rc8/lib/action_dispatch/middleware/static.rb:53:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/railties-3.1.0.rc8/lib/rails/engine.rb:455:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/urlmap.rb:52:in `block in call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/urlmap.rb:46:in `each'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-1.3.2/lib/rack/urlmap.rb:46:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-test-0.6.1/lib/rack/mock_session.rb:30:in `request'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-test-0.6.1/lib/rack/test.rb:219:in `process_request'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/rack-test-0.6.1/lib/rack/test.rb:66:in `post'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/capybara-1.0.1/lib/capybara/rack_test/browser.rb:53:in `process'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/capybara-1.0.1/lib/capybara/rack_test/browser.rb:19:in `submit'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/capybara-1.0.1/lib/capybara/rack_test/form.rb:64:in `submit'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/capybara-1.0.1/lib/capybara/rack_test/node.rb:58:in `click'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-rails-1.0.2/lib/cucumber/rails/capybara/javascript_emulation.rb:16:in `click_with_javascript_emulation'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/capybara-1.0.1/lib/capybara/node/element.rb:93:in `click'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/capybara-1.0.1/lib/capybara/node/actions.rb:38:in `click_button'
  (eval):2:in `click_button'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/capybara-1.0.1/lib/capybara/dsl.rb:139:in `click_button'
  /Users/Jean/nulvierdrie/manager/source/manager/features/step_definitions/reset_password_steps.rb:8:in `block in <top (required)>'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/core_ext/instance_exec.rb:48:in `block in cucumber_instance_exec'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/rb_support/rb_step_definition.rb:62:in `invoke'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/step_match.rb:26:in `invoke'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/step_invocation.rb:59:in `invoke'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/step_invocation.rb:38:in `accept'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:99:in `block in visit_step'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:98:in `visit_step'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/step_collection.rb:15:in `block in accept'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/step_collection.rb:14:in `each'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/step_collection.rb:14:in `accept'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:93:in `block in visit_steps'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:92:in `visit_steps'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/scenario.rb:55:in `block (2 levels) in accept'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/runtime.rb:79:in `block (2 levels) in with_hooks'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/runtime.rb:95:in `before_and_after'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/runtime.rb:78:in `block in with_hooks'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/runtime/support_code.rb:115:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/runtime/support_code.rb:115:in `block (3 levels) in around'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/language_support/language_methods.rb:13:in `block in around'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/language_support/language_methods.rb:95:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/language_support/language_methods.rb:95:in `execute_around'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/language_support/language_methods.rb:12:in `around'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/runtime/support_code.rb:114:in `block (2 levels) in around'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/runtime/support_code.rb:112:in `call'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/runtime/support_code.rb:112:in `around'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/runtime.rb:90:in `around'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/runtime.rb:77:in `with_hooks'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/scenario.rb:53:in `block in accept'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/scenario.rb:108:in `with_visitor'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/scenario.rb:47:in `accept'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:51:in `block in visit_feature_element'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:50:in `visit_feature_element'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/feature.rb:43:in `block in accept'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/feature.rb:42:in `each'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/feature.rb:42:in `accept'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:20:in `block in visit_feature'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:19:in `visit_feature'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/features.rb:29:in `block in accept'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/features.rb:17:in `each'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/features.rb:17:in `each'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/features.rb:28:in `accept'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:14:in `block in visit_features'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:163:in `broadcast'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/ast/tree_walker.rb:13:in `visit_features'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/runtime.rb:45:in `run!'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/cli/main.rb:43:in `execute!'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/lib/cucumber/cli/main.rb:20:in `execute'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/gems/cucumber-1.0.2/bin/cucumber:14:in `<top (required)>'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/bin/cucumber:19:in `load'
  /Users/Jean/.rvm/gems/ruby-1.9.2-p290@manager/bin/cucumber:19:in `<main>'
  features/reset_password.feature:14:in `And I fill in the correct email'
@JeanMertz

This comment has been minimized.

JeanMertz commented Aug 31, 2011

Well I am going to bump this again, I could be totally wrong on how to use this, but in a clean 3.1 app, with only scaffold post this works:

Testapp::Application.config.session_store :cookie_store, key: '_testapp_session', domain: :all

But this fails:

Testapp::Application.config.session_store :active_record_store, key: '_testapp_session', domain: :all

Here is another trace:

TypeError in PostsController#index

can't convert Symbol into String

rack (1.3.2) lib/rack/utils.rb:190:in `+'
rack (1.3.2) lib/rack/utils.rb:190:in `set_cookie_header!'
rack (1.3.2) lib/rack/session/abstract/id.rb:323:in `set_cookie'
rack (1.3.2) lib/rack/session/abstract/id.rb:311:in `commit_session'
rack (1.3.2) lib/rack/session/abstract/id.rb:196:in `context'
rack (1.3.2) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.0) lib/action_dispatch/middleware/cookies.rb:326:in `call'
activerecord (3.1.0) lib/active_record/query_cache.rb:62:in `call'
activerecord (3.1.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
actionpack (3.1.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (3.1.0) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
activesupport (3.1.0) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.0) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (3.1.0) lib/action_dispatch/middleware/reloader.rb:68:in `call'
rack (1.3.2) lib/rack/sendfile.rb:101:in `call'
actionpack (3.1.0) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.1.0) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.0) lib/rails/rack/logger.rb:13:in `call'
rack (1.3.2) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.2) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.0) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.2) lib/rack/lock.rb:15:in `call'
actionpack (3.1.0) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.1.0) lib/rails/engine.rb:455:in `call'
railties (3.1.0) lib/rails/rack/content_length.rb:16:in `call'
railties (3.1.0) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.3.2) lib/rack/handler/webrick.rb:59:in `service'
/Users/Jean/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/Jean/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/Jean/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
@d11wtq

This comment has been minimized.

d11wtq commented Sep 10, 2011

Running into this trying to migrate to 3.1.0 too. The problem actually appears to be in action_dispatch/middleware/cookies.rb not converting the :all special case to the domain name.

@JeanMertz

This comment has been minimized.

JeanMertz commented Sep 10, 2011

Wow, I am not the only one with this issue? I switched to using the cookie_store for now. I find it weird though that this skipped past the tests (if there are any), and no one else brought up this issue. There must be plenty of Rails apps using this method, no?

@d11wtq

This comment has been minimized.

d11wtq commented Sep 10, 2011

I'm using my own custom SessionStore and am trying to see if I can work around the issue, but it appears that there are some places where #handle_options needs to be called in CookieJar (defined in "action_dispatch/middleware/cookies.rb") in order to convert :all to a valid cookie domain. It is called in CookieJar itself, but not in any of its subclasses, and the issue stems from line 190 in rack/utils.rb doing this:

        domain  = "; domain="  + value[:domain] if value[:domain]

Trying to concatenate a String with the Symbol :all fails. value here is a Hash of the form:

{ :value => "actual value", :domain => :all, :path => "/", :expires_in => " .... " }

Rails should have swapped out the :all domain before handing off to Rack, but obviously there's a regression here.

Still poking around.

@d11wtq

This comment has been minimized.

d11wtq commented Sep 10, 2011

I've worked around this in my own SessionStore. What was happening was that Rails was passing the cookie information to Rack as-is, without converting the :domain to :all. This meant that Rack internally could not set cookies, but Rails could set them by passing the correct domain for every cookie being set. Rack internally caches the invalid cookie information in a @default_options hash and it attempts to "commit" the session without Rails (thinking that :all is the domain it should use).

Rails 3.0 only had 3 parameters to set_cookie and destroy has changed too. Both of these method now take an options parameter, which contains the cookie domain used for sessions. I've worked around the problem by mutating this options hash in the same way CookieJar does it (in fact, I just use CookieJar directly). I think there must have been some substantial refactoring of the Session storage to more directly back off of Rack, or something like that, but whatever it was has broken things.

Here's the method I'm invoking in my session handler.

      def handle_options(env, options)
        @cookie_jar ||= ActionDispatch::Request.new(env).cookie_jar
        @cookie_jar.handle_options(options)
      end

It'd be good if this could be fixed so that the options hash passed to set_session and destroy_session is actually "correct" in the first place ;)

@d11wtq

This comment has been minimized.

d11wtq commented Sep 10, 2011

Yup, I see the issue in the ActiveRecord session store:

https://github.com/rails/rails/blob/master/activerecord/lib/active_record/session_store.rb#L317

It receives options in set_session, but doesn't do anything with them. Mutating away :domain => :all here will fix things. There surely has to be a better way though.

5am seems like a good time to go to bed! o_O

@TatianaTyu

This comment has been minimized.

TatianaTyu commented Sep 29, 2011

I'm experiencing the same issue. Temporarily fixed this by explicitly setting domains based on the current environment, e.g. for development:
MySuperApp::Application.config.session_store :active_record_store, :key => '_my_super_session', :domain => ".lvh.me"

Thank you guys for pointing me out where this "can't convert symbol into string" error even comes from, it would take lots of time to figure this out from the stacktrace...

@calvincorreli

This comment has been minimized.

Contributor

calvincorreli commented Oct 9, 2011

Just wanted to +1 this. I've been bitten by the same problem.

Haven't been able to figure out what the proper fix is yet. It's pretty complex layered code.

@d11wtq

This comment has been minimized.

d11wtq commented Oct 9, 2011

For those who are stuck and noting the lack of any response from the core team, this should get you up and running #3047

@macmartine

This comment has been minimized.

Contributor

macmartine commented Oct 14, 2011

+1 on hitting this

@mateomurphy

This comment has been minimized.

mateomurphy commented Oct 24, 2011

Hitting this as well

@lasseebert

This comment has been minimized.

lasseebert commented Nov 5, 2011

+1

14 similar comments
@guarisco

This comment has been minimized.

guarisco commented Nov 10, 2011

+1

@JackPott

This comment has been minimized.

JackPott commented Dec 31, 2011

+1

@davout

This comment has been minimized.

Contributor

davout commented Jan 3, 2012

+1

@carlesso

This comment has been minimized.

Contributor

carlesso commented Jan 4, 2012

+1

@mrudhukar

This comment has been minimized.

mrudhukar commented Jan 18, 2012

+1

@aaronchi

This comment has been minimized.

Contributor

aaronchi commented Jan 24, 2012

+1

@nviennot

This comment has been minimized.

nviennot commented Feb 9, 2012

+1

@lucasprim

This comment has been minimized.

lucasprim commented Feb 9, 2012

+1

@austintaylor

This comment has been minimized.

austintaylor commented Feb 9, 2012

+1

@calvinl

This comment has been minimized.

calvinl commented Feb 29, 2012

+1

@pdenya

This comment has been minimized.

pdenya commented Mar 23, 2012

+1

@scottmessinger

This comment has been minimized.

scottmessinger commented Mar 24, 2012

+1

@RodneyTurnham

This comment has been minimized.

RodneyTurnham commented Mar 29, 2012

+1

@statique

This comment has been minimized.

statique commented Mar 29, 2012

+1

@rafaelfranca

This comment has been minimized.

Member

rafaelfranca commented Apr 30, 2012

Fixed by #6084

@d11wtq

This comment has been minimized.

d11wtq commented Apr 30, 2012

Awesome, thanks!

@TatianaTyu

This comment has been minimized.

TatianaTyu commented Apr 30, 2012

Thanks a lot!

@mhuggins

This comment has been minimized.

mhuggins commented Aug 3, 2012

What version of Rails is #6084 available in? I'm using Rails 3.2.6 and am still encountering this issue in conjunction with redis-store.

@rafaelfranca

This comment has been minimized.

Member

rafaelfranca commented Aug 3, 2012

It will be available only in 4.0.0

@mhuggins

This comment has been minimized.

mhuggins commented Aug 3, 2012

Just tried upgrading to the latest version of Rails (3.2.7), and it's still not working.

MyApp::Application.config.session_store :redis_store, domain: :all,
  servers: { host: 'localhost', port: 6379, db: 0, namespace: 'myapp:sessions' }

Stack trace:

TypeError (can't convert Symbol into String):
  rack (1.4.1) lib/rack/utils.rb:219:in `+'
  rack (1.4.1) lib/rack/utils.rb:219:in `set_cookie_header!'
  rack (1.4.1) lib/rack/session/abstract/id.rb:342:in `set_cookie'
  rack (1.4.1) lib/rack/session/abstract/id.rb:330:in `commit_session'
  rack (1.4.1) lib/rack/session/abstract/id.rb:206:in `context'
  rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
  actionpack (3.2.7) lib/action_dispatch/middleware/cookies.rb:338:in `call'
  activerecord (3.2.7) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
  actionpack (3.2.7) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.7) lib/active_support/callbacks.rb:405:in `_run__3715311219079540099__call__697857605585126000__callbacks'
  activesupport (3.2.7) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.7) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.7) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.7) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.7) lib/action_dispatch/middleware/reloader.rb:65:in `call'
  actionpack (3.2.7) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.7) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.7) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.7) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.7) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.7) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.7) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.7) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.7) lib/rails/engine.rb:479:in `call'
  railties (3.2.7) lib/rails/application.rb:220:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.7) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /Users/mhuggins/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /Users/mhuggins/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /Users/mhuggins/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
@rafaelfranca

This comment has been minimized.

Member

rafaelfranca commented Aug 3, 2012

Just backported to 3-2-stable @ 393c652. Could you try with this branch?

@mhuggins

This comment has been minimized.

mhuggins commented Aug 3, 2012

Awesome, looks like that fixed it! Thanks :)

@mhuggins

This comment has been minimized.

mhuggins commented Aug 3, 2012

Actually, I retract that. I'm still seeing the same stack trace error. :(

@rafaelfranca

This comment has been minimized.

Member

rafaelfranca commented Aug 3, 2012

@mrudhukar could you try with master branch?

@rafaelfranca

This comment has been minimized.

Member

rafaelfranca commented Aug 10, 2012

@mhuggins could you try the pull request #7316?

@mhuggins

This comment has been minimized.

mhuggins commented Aug 10, 2012

Just updated #7316 with my findings.

@krzkrzkrz

This comment has been minimized.

krzkrzkrz commented Jan 18, 2013

Issue still happens

@usbsnowcrash

This comment has been minimized.

usbsnowcrash commented Mar 19, 2014

I am still getting this issue when using the redis session store on Rails 4.

@rafaelfranca

This comment has been minimized.

Member

rafaelfranca commented Mar 24, 2014

@usbsnowcrash could you open a new issue with a way to reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment