0

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?

4
  • 1
    If it's working elsewhere, are you using git? A git clean -fdx to remove everything other than committed source code is worth a quick shot. Commented Oct 7, 2013 at 19:34
  • Maybe you are using private browsing and disabled cookie? Commented Oct 7, 2013 at 19:36
  • @NickVeys, want to write that as an answer? ;-). You saved my week. Thank you. Commented Oct 7, 2013 at 22:38
  • Hah, certainly. :) Glad it helped. Commented Oct 8, 2013 at 15:56

1 Answer 1

1

When all else fails and nothing makes sense anymore, reset the world:

git clean -fdx 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.