Module: Attach::Attachable
- Includes:
- FileUtils
- Defined in:
- lib/attach/attachable.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(klass) ⇒ Object
Set a few ‘magic’ properties.
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
Set a few ‘magic’ properties
22 23 24 25 |
# File 'lib/attach/attachable.rb', line 22 def included(klass) # Set a few 'magic' properties klass.extend(::Attach::Attachable::ClassMethods) klass.after(:create, :assign_attachment_ids) end |
Instance Method Details
#assign_attachment_ids ⇒ Object
114 115 116 117 118 119 120 121 122 |
# File 'lib/attach/attachable.rb', line 114 def return unless @attachments_needing_id @attachments_needing_id.each do |fld, ary| (ary || []).each do |att| att.update(:attachable_id => self.id) end end @attachments_needing_id = nil end |