Я модернизированный мое приложение рельсы версии от 3.2.13 до 4.2.1 так Если когда-нибудь я пытаюсь создать новую запись я получаю ActiveModel::ForbiddenAttributesError
ActiveModel :: ForbiddenAttributesError только при создании новой записи
Я используя рельсы4.2.1.
Это мой контроллер
class CategoriesController < ApplicationController
load_and_authorize_resource
before_action :set_category, only: [:edit, :show, :update, :destroy]
def index
end
def show
end
def new
@category = Category.new
end
def create
@category = Category.new(category_params)
if @category.save
redirect_to @category, :notice => "Successfully created category."
else
render :action => 'new'
end
end
def edit
end
def update
if @category.update_attributes(category_params)
redirect_to @category, :notice => "Successfully updated category."
else
render :action => 'edit'
end
end
def destroy
@category.destroy
redirect_to categories_url, :notice => "Successfully destroyed category."
end
private
def set_category
@category = Category.find(params[:id])
end
def category_params
params.require(:category).permit(:name)
end
end
Всякий раз, когда я обновить существующую категорию не проблема. категория успешно обновляется.
Помощь Pls!
Благодаря