views:

31

answers:

1

Hi... Just started learning how to use paper_clip. I installed everything according the instructions and tried to upload an image (profile_pic)...

I got the error that I can't mass assign profile_pic...

so I added attr_accessible: :profile_pic

And that stopped that error. What I'm curious about is I don't have a 'profile_pic' column in my users table. Instead, thanks to paper_clip, I have: t.string "profile_pic_file_name" t.string "profile_pic_content_type" t.integer "profile_pic_file_size" t.datetime "profile_pic_updated_at"

So in my effort to understand rails, how did that fix the issue? Does setting a model attr_accessible :profile_pic work as a wildcard for everything after the pic, or is this some type of paper_clip magic?

Thanks

A: 

It's because the profile_pic accessor is define to set all of you column. So it's needed to be accessible by mass_upload to define other column.

shingara