Reputation: 220
I have create a session controller for the devise
user login. At view the form is look like below
<%= form_tag new_member_session_path do %> <%= text_field_tag 'user[email]' %> <%= password_field_tag 'user[password]' %> <%= submit_tag 'Login' %> <% end %>And in the controller I don't know about the
new
, create
and destroy
method please help me
class SessionController < ApplicationController
def new
end
def create
end
def destroy
end
end
Thank's
Upvotes: 1
Views: 2931
Reputation: 34072
If you want to use your own views there are two options. If you do not need custom controller logic (which you do not for simply changing the login field to username, as it's a config option), then you can use scoped views, like:
# in config/devise.rb
config.scoped_views = true
Which will trigger devise to look up views based on role, for example within users/sessions
.
If you do need custom controller logic, you would make a controller that subclasses the appropriate devise controller (in your question you do not do this), then tell devise to use your controller.
# app/controllers/users/session_controller.rb
class SessionsController < Devise::SessionsController
end
# then in config/routes.rb
devise_for :users, :controllers => { :sessions => "users/sessions" }
Upvotes: 1