Module: Attachs::ActiveRecord::Base::ClassMethods
- Defined in:
- lib/attachs/active_record/base.rb
Instance Method Summary collapse
- #attachable? ⇒ Boolean
- #attachments ⇒ Object
- #has_attached_file(*args) ⇒ Object
- #inherited(subclass) ⇒ Object
Instance Method Details
#attachable? ⇒ Boolean
68 69 70 |
# File 'lib/attachs/active_record/base.rb', line 68 def attachable? .any? end |
#attachments ⇒ Object
64 65 66 |
# File 'lib/attachs/active_record/base.rb', line 64 def @attachments ||= {} end |
#has_attached_file(*args) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/attachs/active_record/base.rb', line 53 def has_attached_file(*args) = args. unless attachable? make_attachable end args.each do |attr| attr, [attr] = end end |
#inherited(subclass) ⇒ Object
72 73 74 75 |
# File 'lib/attachs/active_record/base.rb', line 72 def inherited(subclass) subclass.instance_variable_set :@attachments, @attachments super end |