开发者

Using "Paperclip" is it advisable/safe/reasonable to add only the column 'attribute_file_name' in a database?

开发者 https://www.devze.com 2023-02-05 17:24 出处:网络
\"Paperclip\" requires to add these columns in a database for a general attachement (in the following example it is named \'attribute\'):

"Paperclip" requires to add these columns in a database for a general attachement (in the following example it is named 'attribute'):

attribute_file_name
attribute_content_type
attribute_file_size
attribute_updated_at

I have not tried to add some of them and the only one who seemed really requ开发者_如何学运维ired was 'avatar_file_name'. If I don't insert that, "Paperclip" will generate an error.

Is it advisable/safe/reasonable to add only the column 'avatar_file_name'?


No, it is not advisable. Those four columns exist for a reason and even if (I don't know) it works to add an attachment without some of those fields present, there will be a lot of functionality that will not work and instead throw errors. Resizing, moving, saving to S3, etc are just examples of what might not work.

Next thing, is there any reason NOT to add all four fields? It doesn't seem likely to me.

Update

Here is a quote from the git repository for paperclip:

Only attachment_file_name is required for paperclip to operate

So it seems like those guys saw the reason before me :)

Still, I think you will lose some functionality but it will not cause any errors.

0

精彩评论

暂无评论...
验证码 换一张
取 消