【发布时间】:2013-06-24 03:05:34
【问题描述】:
每次尝试在下面运行此代码时,我都会不断收到上述错误。我正在尝试从表单中删除信息。可以看看“销毁”的方法吗?
class ArticlesController < ApplicationController
def show
@article = Article.find(params[:id])
end
def new
@article = Article.new
end
def create
@article = Article.new(params[:article])
@article.save
redirect_to article_path(@article)
end
def destroy
@article = Article.new(params[:article])
@article.delete
@article.save
redirect_to article_path(@article)
end
def edit
@article = Article.find(params[:id])
end
end
【问题讨论】:
-
@article 为什么删除后还要保存?
标签: ruby-on-rails ruby-on-rails-3 hash