ruby on rails - The action 'create' could not be found for UsersController -
i doing chapter 7 of michael hartl's rails tutorial, , getting errors when trying sign user in development. have finished chapter through 7.3 of tests should passing now, i'm still receiving the action 'create' not found userscontroller
in development.
here users controller
class userscontroller < applicationcontroller def show @user = user.find(params[:id]) end def new @user = user.new def create @user = user.new(user_params) if @user.save flash[:success] = "welcome sample app!" redirect_to @user else render 'new' end end def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation) end end end
at point in tutorial should able sign user in online form without issue. here github repository https://github.com/ajhausdorf/sample_app
your def new
has not been closed.
this code should works
class userscontroller < applicationcontroller def show @user = user.find(params[:id]) end def new @user = user.new end # here missing def create @user = user.new(user_params) if @user.save flash[:success] = "welcome sample app!" redirect_to @user else render 'new' end end def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation) end end
Comments
Post a Comment