I've run hundreds of migrations in my happy days with Rails but find
an incredible anomoly here that I can't build a simple record in
migrations. I'm getting the error:
Can't mass-assign these protected attributes: field1, field2, etc.
I found a few Googles about people recently having this problem
running a FasterCSV import, but that's it.
Any ideas are greatly appreciated.
Kathleen
On May 30, 10:06 pm, "KathysK...@gmail.com" <KathysK...@gmail.com>
wrote:
> I've run hundreds of migrations in my happy days with Rails but find
> an incredible anomoly here that I can't build a simple record in
> migrations. I'm getting the error:
Have you been using attr_protected or attr_accessible in your models?
They prevent update_attributes, new, create etc... from assigning to
the relevant fields.
> Can't mass-assign these protected attributes: field1, field2, etc.
> I found a few Googles about people recently having this problem
> running a FasterCSV import, but that's it.
> Any ideas are greatly appreciated.
> Kathleen
Mr. Cheung,
Thank you so much for your reply and hopefully this will help others
using 'restful_authentication'. This line is automatically inserted
into the USER model;
If anyone is trying to embellish their user model with the ability for
the user to EDIT or run a migration to load records, they will receive
this message.
Can't mass-assign these protected attributes: field1, field2, etc
Would you just remove this line altogether?
Thank you,
Kathleen
On May 30, 4:09 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> On May 30, 10:06 pm, "KathysK...@gmail.com" <KathysK...@gmail.com>
> wrote:> I've run hundreds of migrations in my happy days with Rails but find
> > an incredible anomoly here that I can't build a simple record in
> > migrations. I'm getting the error:
> Have you been using attr_protected or attr_accessible in your models?
> They prevent update_attributes, new, create etc... from assigning to
> the relevant fields.
> Fred
> > Can't mass-assign these protected attributes: field1, field2, etc.
> > I found a few Googles about people recently having this problem
> > running a FasterCSV import, but that's it.
> > Any ideas are greatly appreciated.
> > Kathleen- Hide quoted text -
> Mr. Cheung, > Thank you so much for your reply and hopefully this will help others > using 'restful_authentication'. This line is automatically inserted > into the USER model;
> If anyone is trying to embellish their user model with the ability for > the user to EDIT or run a migration to load records, they will receive > this message.
> Can't mass-assign these protected attributes: field1, field2, etc
> Would you just remove this line altogether? > Thank you, > Kathleen
The attr_accessible is there for a reason, to protect the application from malicious inputs.
Before you remove it all together. To summarize: Without attr_accessible there, a knowledgeable user can give themselves ownership of user resources or admin privileges.
You might want to instead add the appropriate properties to the attr_accessible.
Am also getting the same error. The application was working fine till yesterday night! All the models have become protected. I have been using authlogic for a long time now. It never caused me a problem. Can paperclip / oauth cause it? -- Posted via http://www.ruby-forum.com/.
KathysK...@gmail.com wrote: > I've run hundreds of migrations in my happy days with Rails but find > an incredible anomoly here that I can't build a simple record in > migrations.
[...]
Generally, you should not be building records in your migrations. What are you trying to do here?