레일즈 3에서 papaerclip을 ActiveRecord :: Base에서 상속받지 않은 모델에서 사용하고 싶습니다. 다른 모델과 마찬가지로 모델을 저장할 필요가 없으며 일부 ActiveModel 믹싱 만 사용됩니다.클래스의 종이 클립
class ThemeSettings
include ActiveModel::Validations
validate :no_attachement_errors
has_attached_file :logo,
:styles => { :mini => '48x48>', :small => '100x100>', :normal => '240x240>', :large => '600x600>' },
:default_style => :normal,
:url => "/assets/logos/:id/:style/:basename.:extension",
:path => ":rails_root/public/assets/logos/:id/:style/:basename.:extension"
def logo_file_name
..
end
def logo_file_name=(file_name)
..
end
def logo_content_type ..
def logo_content_type=(content_type) ..
def logo_file_size ..
def logo_file_size=(file_size) ..
def logo_updated_at ..
def logo_updated_at=(updated_at) ..
end
종이 클립 그렇게 좋아하지 않는다 :
나는 이런 식으로 뭔가를 만들어NoMethodError: undefined method 'has_attached_file' for ThemeSettings:Class
다음
has_attached_file
방법은 혼합되지 않습니다. Paperclip을 어떻게 간단한 수업처럼 설득 할 수 있습니까? 당신의 도움을 주셔서 감사합니다!
이것은 나를 위해 작동하지 않았다. – Tony