Activating Active_Record_Store session kills the app

Hi!

I’m working on my first Rails (2.3.5) app and I’m experimenting with
activating the Active Record Store after running into the 4K limit of
the Cookie Store (I don’t really know how I ended up filling the cookie
store, I didn’t put that much in there!).

I didn’t do much:

  1. rake db:sessions:create
  2. rake db:migrate

=> Sessions table got created

  1. added “config.action_controller.session_store = :active_record_store”
    to environment.rb

And now I can’t even start Mongrel!

“2540”
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://127.0.0.1:3000
F:/Programming/Ruby/Ruby186/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/middleware_stack.rb:98:in
`insert_after’: You have a nil object when you didn’t expect it!
(NoMethodError)
You might have expected an instance of Array.
The error occurred while evaluating nil.+

Also, if I try to run a rake task, such as a db:migrate, I get a similar
error:

rake db:migrate
(in F:/Programming/Ruby/Workspace/shareyourstyle)
rake aborted!
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.+

If I disable the line in environment.rb, everything is back to normal…

Any idea what is going on? Those errors message are really not doing
much for me :frowning:

Thanks for your help!

Guillaume

On Feb 21, 1:09 pm, Guillaume G. [email protected] wrote:

“2540”
=> Booting Mongrel
=> Rails 2.3.5 application starting onhttp://127.0.0.1:3000
F:/Programming/Ruby/Ruby186/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/act ion_controller/middleware_stack.rb:98:in
`insert_after’: You have a nil object when you didn’t expect it!
(NoMethodError)
You might have expected an instance of Array.
The error occurred while evaluating nil.+

Are you doing any other fiddling with the middleware stack ?

Fred

Are you doing any other fiddling with the middleware stack ?

Fred

Fred,

I personally don’t :slight_smile:

Now, one of the plugin I use may… I removed the active_store line from
environment.rb (otherwise I can’t run anything) and ran “rake
middleware”:

rake middleware
(in F:/Programming/Ruby/Workspace/shareyourstyle)
use Rack::Lock
use ActionController::Failsafe
use ActionController::Session::CookieStore, #Proc:0x04d38098@:8(eval)
use Rack::Facebook, “523d1154a982433afddb3f5f77c0d17c”
use ActionController::ParamsParser
use Rack::MethodOverride
use Rack::Head
use ActionController::StringCoercion
use ActiveRecord::ConnectionAdapters::ConnectionManagement
use ActiveRecord::QueryCache
run ActionController::Dispatcher.new

I can see Facebook (Facebooker plugin) here, and CookieStore … The
rest is the default, I guess?

Guillaume

Hey!

I made it work by going into initializers / session_store.rb and
activating the :active_record_store from there, using the line that was
already there and commented (duh) :

ActionController::Base.session_store = :active_record_store

Which is different from the one line I added to environment.rb:

config.action_controller.session_store = :active_record_store

So either the problem was :

  1. the order in which files are loaded?
  2. the line I used was only valid for previous versions of rails?

Any idea? Would love to have a better understanding of what I just did
:wink: