Module: RailsUploads::ActiveRecord::Base::ClassMethods
- Defined in:
- lib/rails_uploads/active_record/base.rb
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
59 60 61 |
# File 'lib/rails_uploads/active_record/base.rb', line 59 def end |
Class Method Details
.extended(base) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/rails_uploads/active_record/base.rb', line 61 def self.extended(base) [:image].each do |type| base.send(:define_singleton_method, "attached_#{type}") do |*args| = args. [:type] = type attached_file *args.append() end end end |
Instance Method Details
#attached_file(*args) ⇒ Object
71 72 73 74 75 |
# File 'lib/rails_uploads/active_record/base.rb', line 71 def attached_file(*args) = args. .reverse_merge! type: :file *args.append() end |
#inherited(subclass) ⇒ Object
77 78 79 80 |
# File 'lib/rails_uploads/active_record/base.rb', line 77 def inherited(subclass) subclass.instance_variable_set(:@attachments, ) super end |
#is_attachable? ⇒ Boolean
82 83 84 |
# File 'lib/rails_uploads/active_record/base.rb', line 82 def is_attachable? .present? end |