小编tom*_*ise的帖子

Posts控制器,rails 4中的参数错误数量为1​​(0为0)?

我在我的显示操作中的帖子控制器中收到错误消息"错误的参数数量错误(1为0).我将评论该特定行的结尾.感谢您的帮助.

def show
  @post = Post.all(:order => 'created_at DESC') #this is the error line
end

def new
  @post = Post.new
end

def create
  @post = Post.new(params[:post])

  if @post.save
    redirect_to @post
  else
   render :new
  end
end
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails ruby-on-rails-4 ruby-2.1

0
推荐指数
1
解决办法
1619
查看次数

标签 统计

ruby ×1

ruby-2.1 ×1

ruby-on-rails ×1

ruby-on-rails-4 ×1