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.
62 63 64 |
# File 'lib/rails_uploads/active_record/base.rb', line 62 def end |
Class Method Details
.extended(base) ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/rails_uploads/active_record/base.rb', line 64 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
74 75 76 77 78 |
# File 'lib/rails_uploads/active_record/base.rb', line 74 def attached_file(*args) = args. .reverse_merge! type: :file *args.append() end |
#inherited(subclass) ⇒ Object
80 81 82 83 |
# File 'lib/rails_uploads/active_record/base.rb', line 80 def inherited(subclass) subclass.instance_variable_set(:@attachments, ) super end |
#is_attachable? ⇒ Boolean
85 86 87 |
# File 'lib/rails_uploads/active_record/base.rb', line 85 def is_attachable? .present? end |