Does paperclip require all 4 columns (_file_name, _content_type,etc)?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 00:14:24

问题


I am wondering if Paperclip does require all four columns in database as:

  add_column :users, :avatar_file_name,    :string
  add_column :users, :avatar_content_type, :string
  add_column :users, :avatar_file_size,    :integer
  add_column :users, :avatar_updated_at,   :datetime

Can I just add the avatar_file_name? And not add the other 3 columns?

It is because I wont to use paperclip instead of the filecolumn gem. And it uses only 1 column therefor I don´t want fill out all columns that paperclip support.


回答1:


I'm pretty sure you could just add one column + 3 attr_accessor playing a dummy role.

But this looks awkward and I wouldn't advise to do so.



来源:https://stackoverflow.com/questions/7475947/does-paperclip-require-all-4-columns-file-name-content-type-etc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!