Error: /home/g3mini/Desktop/management/app/controllers/user_controller.rb:3: syntax error, unexpected tIDENTIFIER, expecting keyword_end @users is User.all ^
code:
class UserController < ApplicationController
def index
@users is User.all
end
def create
end
def store
@user = User.new(params.require(:user).permit(:userame,:password))
@user.save
redirect_to '/'
end
end
Could anyone please tell me what is going wrong? (total noob here) Thanks,
g3
The problem is in your use of is
instead of =
. You should use: @users = User.all
在第3行
@users = User.all
The keyword "is" is not valid. I assume that you want @users = User.all
用@users = User.all
替换@users is User.all
@users = User.all
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.