ruby on rails - Uninitialized constant error in controller when deploy to heroku -
i try set devise , omniauth follow https://github.com/plataformatec/devise/wiki/omniauth:-overview , deploy heroku. there no error in localhost , when push heroku , app crash. in heroku logs , found 'uninitialized constant users' error in omniauth_callbacks_controller.rb . how initialize users? have heroku rake db:migrate already. cant run heroku console because app crash , cant check there user model. information , generate controller rails g omniauth_callbacks_controller
in heroku logs
/disk1/home/slugs/338566_ad6243a_bbb1-19eae435-d901-44ba-9dd5-baf36d656448/mnt/app/controllers/omniauth_callbacks_controller.rb:1: uninitialized constant users (nameerror)
in omniauth_callbacks_controller.rb
class users::omniauthcallbackscontroller < devise::omniauthcallbackscontroller def facebook @user = user.find_for_facebook_oauth(env["omniauth.auth"], current_user) if @user.persisted? flash[:notice] = i18n.t "devise.omniauth_callbacks.success", :kind => "facebook" sign_in_and_redirect @user, :event => :authentication else session["devise.facebook_data"] = env["omniauth.auth"] redirect_to new_user_registration_url end end end
are sure user model has been created in heroku's database?
in terminal (not rails console!) enter
heroku rake db:migrate
that migrate heroku's db's match code. still have error?
Comments
Post a Comment