A
A
Alex Goncharov2014-02-23 15:01:19
Ruby on Rails
Alex Goncharov, 2014-02-23 15:01:19

ActiveModel::ForbiddenAttributesError in Rails 4. How to solve?

I have code in items_controller controller.

def edit
    @item = Item.find(params[:id])
  end

  def update
    @item = Item.find(params[:id])
    @item.update_attributes(params[:item])
    if @item.errors.empty?
      redirect_to item_path(@item)
    else
      render "edit"
    end
  end

When I try to edit localhost:3000/items/1/edit I get:
468462_kiss_26kb.jpg
What should I do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Morozov, 2014-02-23
@calirails

To the whitelist, all to the whitelist.
guides.rubyonrails.org/action_controller_overview....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question