Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

uninitialized constant ActionController::Session::MemoryStore

#1876

I have installed the 2.3RC1 and as start an existing projet, that is working on 2.2 the server stop its launch with the error:

** /Library/Ruby/Gems/1.8/gems/activesupport-2.3.0/lib/active_support/dependencies.rb:440:in load_missing_constant': uninitialized constant ActionController::Session::MemoryStore (NameError) **

My environment.rb contains the following line * config.action_controller.session_store = :memory_store *

The error disappear when I change it to :active_record_store

Reported by bille2 · February 4th, 2009 @ 08:23 PM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. DHH
    DHH
    • State changed from new to invalid

    The MemoryStore has been killed off. I'd recommend either using active_record_store or, even better, start using the default cookie store.

    February 6th, 2009 @ 02:01 PM

  2. samur araujo
    samur araujo

    Hi all, I can not see a reason to remove memory_store from rails 2.3 sessions. Sometimes it is too much simple to configure a session as : config.action_controller.session_store = :memory_store

    I do not feel comfortable in use active_record_store or mem_cache_store in my app. My application does not have a database, so I am not using the active_record_store, and I do not want to configure one because all my data comes from Semantic Web endpoints.

    Also, I don't want to configure a cache server to store users' sessions because my app is too small to demand such effort.

    I thing that :memory_store has its applicability and should be kept in future version.

    Regards, Samur Araújo Msc. Compute Science - PUC-Rio - Brasil

    April 7th, 2009 @ 07:09 PM

  3. bshand
    bshand

    :memory_store is useful only in very limited circumstances -- very simple servers where session data must be kept secret, or servers which require session fixation for other reasons. But here is a re-implementation for Rails 2.3, in case you really need it. Put the file into It's not threadsafe, just like the original.

    # Port of old CGI::Session::MemoryStore to Rails 2.3
    module ActionController
      module Session
        # In-memory session storage class.
        #
        # Implements session storage as a global in-memory hash.  Session
        # data will only persist for as long as the ruby interpreter 
        # instance does.
        class MemoryStore < AbstractStore
          GLOBAL_HASH_TABLE = {} #:nodoc:
    
          private
            def get_session(env, sid)
              sid ||= generate_sid
              session = GLOBAL_HASH_TABLE[sid] || {}
              session = AbstractStore::SessionHash.new(self, env).merge(session)
              [sid, session]
            end
    
            def set_session(env, sid, session_data)
              GLOBAL_HASH_TABLE[sid] = session_data
              return true
            end
        end
      end
    end unless RAILS_GEM_VERSION =~ /^([01]\.|2\.[012]\.)/
    

    November 20th, 2009 @ 02:21 PM

  4. bshand
    bshand

    Create a file in config/initializers/ containing the above code; then your existing session configuration will continue to work in Rails 2.3.

    November 20th, 2009 @ 02:24 PM