Module: Griddle::HasGridAttachment::InstanceMethods
- Defined in:
- lib/griddle/has_grid_attachment.rb
Instance Method Summary collapse
- #attachment_for(name, options = {}) ⇒ Object
- #destroy_attached_files ⇒ Object
- #each_attachment ⇒ Object
- #save_attached_files ⇒ Object
Instance Method Details
#attachment_for(name, options = {}) ⇒ Object
34 35 36 37 |
# File 'lib/griddle/has_grid_attachment.rb', line 34 def name, = {} @_gripster_attachments ||= {} @_gripster_attachments[name] ||= Attachment.for(name, self, ) end |
#destroy_attached_files ⇒ Object
39 40 41 |
# File 'lib/griddle/has_grid_attachment.rb', line 39 def destroy_attached_files {|name, | .destroy } end |
#each_attachment ⇒ Object
43 44 45 46 47 |
# File 'lib/griddle/has_grid_attachment.rb', line 43 def self.class..each do |name, definition| yield(name, (name)) end end |
#save_attached_files ⇒ Object
49 50 51 52 53 54 |
# File 'lib/griddle/has_grid_attachment.rb', line 49 def save_attached_files do |name, | .owner_id = self.id .send(:save) unless .nil? end end |