遇到错误语法错误,意外的$ end,期望keyword_end

时间:2013-02-22 11:00:19

标签: ruby-on-rails

我一直坚持这个错误一段时间了,我已经环顾四周,显然这是由于end太多了,但我似乎无法理解为什么,任何帮助人员?感谢。

这是我的代码

class UsersController < ApplicationController
  def new
    @user = User.new
  end

  def create
    @user = User.new(params[:user])
    if @user.save
      redirect_to root_url, :notice => "Signed up!"
    else
      render "new"
  end

1 个答案:

答案 0 :(得分:3)

class UsersController < ApplicationController
  def new
    @user = User.new
  end

  def create
    @user = User.new(params[:user])

    if @user.save
      redirect_to root_url, :notice => "Signed up!"
    else
      render "new"
    end # your missed end here
  end
end # another end missed for the class