I love the idea of the cookie fix for session storage. But… I’ve gone
round
and round to get edge working with a legacy app and wonder if anyone has
any
pointers. Here’s what’s happening. I fresh-installed:
rails foo
cd foo
rake rails:freeze:edge
rake rails:update
– add secret to environment.rb –
All good, passing tests, no problems with session cookies. Then I cp -r
my
application tree over, preserving environment.rb. After that copy, I
get:
I’ve verified that the cookie name is coming in as empty and the
ArgumentError is being raised for a reason. I just don’t see why that
would
be.
Does anyone have any thoughts about this?
Here’s more about the environment:
About your application’s environment
Ruby version 1.8.5 (i686-darwin8.8.1)
RubyGems version 0.9.1
Rails version 1.2.0
Active Record version 1.14.4
Action Pack version 1.12.5
Action Web Service version 1.1.6
Action Mailer version 1.2.5
Active Support version 1.3.1
Edge Rails revision 6414
Application root /Users/sxross/rails/amu_edge
Environment development
Database adapter mysql
Database schema version 0
Plugins:
exception_notification
file_column
haml
<two that I wrote that don’t hack rails>
I love the idea of the cookie fix for session storage. But… I’ve gone round
and round to get edge working with a legacy app and wonder if anyone has any
pointers. Here’s what’s happening. I fresh-installed:
You need to provide :session_key and :secret session options in
environment.rb. It’s generated for you in new apps.
config.action_controller.session = { :session_key =>
‘_myapp_session’, :secret => ‘ssh! be quiet’ }
Note that it’s moving from application.rb to the environment.
Here’s a follow-up question. Are session_id values guaranteed to
remain the same between calls? I know you aren’t relying on the
session_id to identify the information anymore.
The session cookie now contains data rather than an id.
I only ask because I’ve been looking at Simple Captcha, which uses
the session_id as part of the hash that identifies the captcha answer
in pstore. Oddly, the session_id works perfectly with this when using
AR session store, but not with the new cookie-based session store.
You can store an id in the session data instead.
Rick O.'s CSRF-prevention plugin takes this approach.
Here’s a follow-up question. Are session_id values guaranteed to
remain the same between calls? I know you aren’t relying on the
session_id to identify the information anymore.
I only ask because I’ve been looking at Simple Captcha, which uses
the session_id as part of the hash that identifies the captcha answer
in pstore. Oddly, the session_id works perfectly with this when using
AR session store, but not with the new cookie-based session store.
Thoughts?
Thx
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.