Last Updated: February 25, 2016
·
747
· ahmednadar

Active Admin solution for ForbiddenAttributes

While working on a Project, Tasks application with active admin, I was not able to create a project or task and got this error:

ActiveModel::ForbiddenAttributesError in Admin::TasksController#create

Solution...

Add following code to admin/task.rb
controller do def permitted_params params.permit task: [:title, :project_id, :admin_user_id, :is_done, :due_date] end end
and Add following code to admin/product.rb

controller do
  def permitted_params
    params.permit project: [:title]
  end
end

DONE :)