ruby on rails - The action 'create' could not be found for SessionsController -


i'm new ruby on rails , i'm attempting create user login page. i'm using sessions. whenever open login page, loads, when try put in login information of user know exists, error

unknown action action 'create' not found sessionscontroller 

my routes file looks this. note, i'm using teachers user class here.

myapp::application.routes.draw    root :to => 'home#index'      'teachers' => 'teachers#all'      'profile' => 'teachers#show'      'signup'  => 'teachers#new'      'login'   => 'sessions#new'   post   'login'   => 'sessions#create'   delete 'logout'  => 'sessions#destroy'   resources :teachers end 

and sessions controller

class sessionscontroller < applicationcontroller   module sessionshelper      def new       @session=session.new     end      def log_in(teacher)       session[:teacher_id] = teacher.id     end      def create       teacher = teacher.authenticate(params[:session][:email],                                params[:session][:password])       if teacher.nil?         flash.now[:error] = "invalid email/password combination."         @title = "sign in"         render 'new'       else         sign_in teacher         redirect_to teacher       end     end      def remember(teacher)       teacher.remember       cookies.permanent.signed[:teacher_id] = teacher.id       cookies.permanent[:remember_token] = teacher.remember_token     end      def current_teacher       if (teacher_id = session[:teacher_id])         @current_teacher ||= teacher.find_by(id: teacher_id)       elsif (teacher_id = cookies.signed[:teacher_id])         teacher = teacher.find_by(id: teacher_id)         if teacher && teacher.authenticated?(cookies[:remember_token])           log_in teacher           @current_teacher = teacher         end       end     end      def logged_in?       !current_teacher.nil?     end      def log_out       session.delete(:teacher_id)       @current_teacher = nil     end      def destroy       log_out if logged_in?       redirect_to root_url     end    end end 

is there way resolve this?


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -