【发布时间】:2011-08-10 05:35:39
【问题描述】:
这是我要在模型中做的事情:
has_attached_file :photo, :styles => self.image_sizes, :whiny => false
validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'],
:message => I18n.t('paperclip.invalid_image_type', :file => self.photo.original_file_name)
我找不到解决方案我应该如何在original_file_name 中获取文件名:
NameError (undefined local variable or method `photo_file_name' for #<Class:0xaafb004>):
或
NoMethodError (undefined method `photo' for #<Class:0xb303e7c>):
【问题讨论】:
-
你能在这里发布你遇到的错误
标签: ruby-on-rails validation file paperclip