Forums » Development »
Redmine > 3.0 : Redmine::SafeAttributes unable to mass-assign attributes.
Added by Rupesh J almost 10 years ago
Hello,
I have developed plugins in the following syntax,
class Book < ActiveRecord::Base unloadable include Redmine::SafeAttributes safe_attributes 'title', 'project', 'user_id', 'category' end
class BooksController < ApplicationController unloadable before_filter :find_project_by_project_id, :authorize .. def create @book = Book.new @book.safe_attribues = params[:book] @book.save end ... end
Now the problem, The log says that mass-assigment is not allowed ( 'Can't mass-assign protected attributes' ).
And the save fails.
I am not able to figure out what is that I am doing wrong.
Can anybody please suggest me the correct usage of these safe attributes.
Thanks.
Replies (1)
RE: Redmine > 3.0 : Redmine::SafeAttributes unable to mass-assign attributes. - Added by Leonel Iturralde over 9 years ago
I found this on stackoverflow
http://stackoverflow.com/questions/6062971/rails-warning-cant-mass-assign-protected-attributes
Check if it is useful for your problem