Note that there are some explanatory texts on larger screens.

plurals
  1. PODisabling :cookie_only in the session store in Rails 3?
    primarykey
    data
    text
    <p>We have a Rails app which communicates with a PhoneGap-based iPhone app. We are in the process of upgrading the Rails app from Rails 2.3.5 to 3. Due to some issues getting PhoneGap to play nice with Rails's cookies, the Rails app (pre-upgrade) was configured with <code>:cookie_only</code> set to false:</p> <pre><code>ActionController::Base.session = { :key =&gt; '_our_key', :secret =&gt; 'ourreallyreallylongsecret', :cookie_only =&gt; false } </code></pre> <p>This configuration was translated to the following for Rails 3:</p> <pre><code>OurApp::Application.config.session_store :cookie_store, :key =&gt; '_our_key' OurApp::Application.config.secret_token = 'ourreallyreallylongsecret' </code></pre> <p>The problem is, I cannot figure out how to use the <code>:cookie_only</code> option in Rails 3. Now, I realize that setting <code>:cookie_only</code> to false is a really bad idea and leads to nasty session fixation exploits. We are certainly planning on fixing this in the future. However, the existing iPhone app relies on this behavior in order to function at all. So I need to be able to get the iPhone app to work for the short run while we overhaul the iPhone app's session stuff.</p> <p>Looking at the Rails source for <code>CookieStore</code>, it looks like they really don't want us to be able to use that option anymore:</p> <pre><code>def initialize(app, options = {}) super(app, options.merge!(:cookie_only =&gt; true)) freeze end </code></pre> <p>We monkey patched the Rails source to merge in <code>:cookie_only =&gt; false</code>, which did not work. We even went so far as to just directly set <code>@cookie_only = false</code> in <code>AbstractStore</code>'s <code>initilize</code> method, but it just got ignored. It seems as though the <code>CookieStore</code> implementation no longer honors <code>@cookie_only</code>.</p> <p>Is there really no way whatsoever to use this functionality in Rails 3? Any help would be GREATLY appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload