Ruby语法错误:意外的tIDENTIFIER,期待keyword_end

时间:2015-06-26 13:05:37

标签: ruby-on-rails ruby syntax-error

错误: /home/g3mini/Desktop/management/app/controllers/user_controller.rb:3: syntax error, unexpected tIDENTIFIER, expecting keyword_end @users is User.all ^

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

有谁能告诉我出了什么问题? (总noob在这里) 谢谢,

G3

4 个答案:

答案 0 :(得分:3)

问题在于您使用is而不是=。你应该使用: @users = User.all

答案 1 :(得分:1)

第3行

@users = User.all

答案 2 :(得分:1)

关键字“是”无效。我假设你想要@users = User.all

答案 3 :(得分:1)

@users is User.all替换为@users = User.all