行动' destory'在控制器中找不到

时间:2014-08-01 02:16:48

标签: ruby-on-rails

我想我失去了它。我无法弄清楚为什么一个简单的破坏链接不会突然发挥作用。

我收到此错误:

在/ plans / v41w74v2的

AbstractController :: ActionNotFound 行动“摧毁”#39;找不到PlansController

计划控制器:

class PlansController < ApplicationController
before_filter :authenticate_user!

def index
  @plans = Plan.all
end
def new
  @plan = Plan.new
end
def create
  @plan = Plan.new(plan_params)
  if @plan.save
    if @plan.trips.empty?
      @possible = @plan.group.trips
      render "add_trips"
    else
      redirect_to plans_path, notice: "Plan successfully created"
    end
  else
    render "new"
  end
end
def show
  @plan = Plan.find_by_unique_identifier(params[:id])
end
def edit
  @plan = Plan.find_by_unique_identifier(params[:id])
  @group = @plan.group
  @possible = @plan.group.trips
  render "add_trips"
end
def update
  @plan = Plan.find_by_unique_identifier(params[:id])
  if @plan.update_attributes(plan_params)
    redirect_to plans_path, notice: "Plan successfully updated!"
  else
    render "edit"
  end
end
def add_trips
  @plan = Plan.find_by_unique_identifier(params[:id])
  trip.each.update_attributes(plan_id: @plan.id)
  redirect_to plans_path, notice: "Trips added to plan"    
end
def destory
  @plan = Plan.find_by_unique_identifier(params[:id])
  @plan.destroy
end

计划秀视图:

<%= button_to "Delete", @plan, method: :delete, data: { confirm: "Are you sure you want to delete this plan?"} %>

我做错了什么?

1 个答案:

答案 0 :(得分:6)

是的。你有一个错字。 destory