Ruby on rails 尝试销毁实例时参数数目错误(1代表0)
我不断收到一个错误:参数数量错误(1代表0)Ruby on rails 尝试销毁实例时参数数目错误(1代表0),ruby-on-rails,Ruby On Rails,我不断收到一个错误:参数数量错误(1代表0) 我试图销毁@event,但它不起作用,因为@event=event.find(params(:id))的参数数目错误。我做错了什么?它应该是params[:id]而不是params(:id)好的捕获。。。我甚至没有注意到。 def destroy @event = Event.find(params(:id)) @event.destroy flash[:success] = "Event destroyed." re
我试图销毁@event,但它不起作用,因为@event=event.find(params(:id))的参数数目错误。我做错了什么?它应该是
params[:id]
而不是params(:id)
好的捕获。。。我甚至没有注意到。
def destroy
@event = Event.find(params(:id))
@event.destroy
flash[:success] = "Event destroyed."
redirect_to events_path
end