Module: FriendlyAttributes::ClassMethods
- Defined in:
- lib/friendly_attributes/class_methods.rb
Instance Method Summary collapse
-
#friendly_details(*args, &block) ⇒ DetailsDelegator
Configure a Friendly Base model associated with an ActiveRecord model.
- #friendly_mount_uploader(name, klass) ⇒ Object
Instance Method Details
#friendly_details(klass, attributes) ⇒ DetailsDelegator #friendly_details(klass, attributes, options) ⇒ DetailsDelegator
Configure a Friendly Base model associated with an ActiveRecord model.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/friendly_attributes/class_methods.rb', line 13 def friendly_details(*args, &block) klass = args.shift = args. attributes = args. if attributes.empty? attributes = = {} end DetailsDelegator.new(klass, self, attributes, , &block).tap do |dd| dd.setup_delegated_attributes dd.instance_eval(&block) if block_given? end end |
#friendly_mount_uploader(name, klass) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/friendly_attributes/class_methods.rb', line 28 def friendly_mount_uploader(name, klass) mount_uploader name, klass instance_eval do alias_method :read_uploader, :read_friendly_attribute alias_method :write_uploader, :write_friendly_attribute end end |