Reputation: 1797
I've been trying for the last 4 days to understand what has happened so that session isn't getting initialized anymore.
My app was working just fine, until one day suddenly i started having the error
undefined local variable or method `session' for < StaticPagesController:0x7c84728 >
I debugged it and tracked it down to request_forgery_protection.rb
file, under action_controller\metal
.
def form_authenticity_token
session[:_csrf_token] ||= SecureRandom.base64(32)
end
So, apparently, session wasn't being loaded.
I then tried suggestions from How force that session is loaded?, as you may see below.
def root
if signed_in?
...
else
session[:init] = true
session[:init]
@prospect = Prospect.new()
render 'retailers/retailers_home'
end
end
but still the same error keeps showing up.
Under my intializers, session_store.rb, everything seems fine :
RecibosOnline::Application.config.session_store :cookie_store, key: '_RecibosOnline_session'
as this exact code works on other developer's machine, as well as on other server. So this must be something specific to my machine...but why??
What might be causing this?
Upvotes: 0
Views: 164
Reputation: 23939
When all else fails and nothing makes sense anymore, reset the world:
git clean -fdx
Upvotes: 1