ruby on rails - A before_filter for Omniauth Facebook? -


for devise there easy use before_filter use in controllers.

for reason can't work omniauth_facebook gem. followed railscast on facebook omniauth ,

 before_filter :authenticate    def authenticate    redirect_to :login unless user.find_by_provider_and_uid(auth["provider"], auth["uid"])  end  end 

but error:

   nameerror in postscontroller#new      undefined local variable or method `auth' #<postscontroller:0x007f9fbfa7ee58> 

any thoughts?

it can't find variable named auth. need check auth variable initialized somewhere or not. per view, omniauth facebook gem storing authenticated data in request env. please refer this: https://github.com/mkdynamic/omniauth-facebook#auth-hash.

before_filter execute before serving request. may causes issues.

hope helps!!!


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -