let's say, i've got 2 apps which use the same database(app), and i've got a field say: cool, so i want to use this field in first app but not in second. so how to avoid this error Can't mass-assign protected attributes without using attr_accessible in database(app) ?
I'm not sure if I understand, but this is what I ususally do:
protected_attribute = params[:blog_post].delete(:protected_attribute)
@blog_post = BlogPost.new(params[:blog_post])
@blog_post.protected_attribute = protected_attribute
if @blog_post.save
# ...
else
# ...
end
It's ugly, but circumvents the mass-assign protection.
Update: You also have to remove the protected attribute from the params.