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

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -