Module: Seamus::ClassMethods

Defined in:
lib/seamus.rb

Instance Method Summary collapse

Instance Method Details

#has_file(attribute) ⇒ Object

Creates an accessor for a Seamus-enabled file. has_file :upload would create an #upload method and a #upload= method.



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/seamus.rb', line 70

def has_file(attribute)
  self.class_eval(%Q(
    def #{attribute.to_s}=(file)
      @#{attribute.to_s} = Seamus::Builder.new(file)
    end
    
    def #{attribute.to_s}
      @#{attribute.to_s}
    end
  ))
end