ruby on rails - undefined method `session_path' -
i using rails + devise + omniauth + google oauth2.
my user model (user.rb) contains:
devise :registerable, :omniauthable, :omniauth_providers => [:google_oauth2]
my routes.rb like:
rails.application.routes.draw devise_for :users, controllers: { omniauth_callbacks: 'omniauth_callbacks' } devise_scope :user 'sign_in', :to => 'devise/sessions#new', :as => :new_user_session post 'sign_in', :to => 'devise/session#create', :as => :user_session 'sign_out', :to => 'devise/sessions#destroy', :as => :destroy_user_session end 'services', to: 'static_pages#services' 'my_account', to: 'my_account#index' 'invite', to: 'invite#show' 'invite/:id', to: 'invite#show' root 'static_pages#home' end
when go /sign_in, exception like:
undefined method `session_path' #<#<class:0x007f9b7173af28>:0x007f9b713d8da8>
in:
~/.rvm/gems/ruby-2.1.1/gems/devise-3.2.4/app/views/devise/sessions/new.html.erb
in line:
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) |f| %>
if add :database_authenticatable user.rb starts working, want users able sign-in through google oauth2 only, don't want :database_authenticable. looks session_path not available reason, not sure why , how make available.
thanks, jen
you need reboot rails server. solution me.
Comments
Post a Comment