railsware / rack_session_access

Rack middleware that provides access to rack.session environment
MIT License
257 stars 29 forks source link

Invalid documentation #3

Closed jsuwo closed 11 years ago

jsuwo commented 12 years ago

In the README, it states to add the following to spec/spec_helper.rb:

Rails.application.configure do
   config.middleware.use RackSessionAccess::Middleware
end

First, the block variable config is not defined, so this raises an error. It should be:

Rails.application.configure do |config|
   config.middleware.use RackSessionAccess::Middleware
end

Second, at least under Rails 3.2.8, I get the error:

private method `configure' called for ...

The code must be:

Rails.application.config.middleware.use RackSessionAccess::Middleware

This still did not work for me, as I would receive the following error whenever I attempted to use page.set_rack_session:

     Failure/Error: page.set_rack_session(user_id: @student.id) # Log the user in
     ActionController::RoutingError:
       No route matches [GET] "/rack_session/edit"

I ended up having to add the following line in config/environments/test.rb before it would work:

config.middleware.use RackSessionAccess::Middleware

Just thought I'd add this for anyone else having the same issue.

amaia commented 12 years ago

@jsuwo your solution worked for me too in a new Rails 3.2.8 app, thanks for posting it.

ahorner commented 11 years ago

@jsuwo I ran into the problems you outline in Rails 3.29 as well. Thanks for the solutions.

ayanko commented 11 years ago

Updated

vanso-waqar commented 10 years ago

Thanks @jsuwo that help as well for Rails 3.2.13