Module: Attachie::ClassMethods
- Defined in:
- lib/attachie.rb
Instance Method Summary collapse
Instance Method Details
#attachment(name, options = {}) ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/attachie.rb', line 170 def (name, = {}) self. = .merge(name => ) define_method name do |version = nil, = {}| return instance_variable_get("@#{name}") if version.nil? (name).version(version, ) end define_method "#{name}=" do |value| self.updated_at = Time.now if respond_to?(:updated_at=) && !value.nil? instance_variable_set "@#{name}", value end end |