我的UsersController类遇到unexpected keyword_end, expecting end-of-input
语法错误,但是我的生活不能弄清楚这里拼写错误/为什么end
抛出它关闭。
Class UsersController < ApplicationController
before_action :authenticate_user!
def update
if current_user.update_attributes(user_params)
flash[:notice] = "User information updated"
redirect_to edit_user_registration_path
else
flash[:error] = "Invalid user information"
redirect_to edit_user_registration_path
end
end
private
def user_params
params.require(:user).permit(:name, :avatar)
end
end
答案 0 :(得分:1)
定义类时,关键字“class”应为小写,而不是大写,因此请尝试更改:
Class UsersController < ApplicationController
到
class UsersController < ApplicationController
希望有所帮助!