Module: Transit::Model::Attachments

Extended by:
ActiveSupport::Concern
Defined in:
lib/transit/model/attachments.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#filesObject

Convenience method for only finding the assets that are files



22
23
24
# File 'lib/transit/model/attachments.rb', line 22

def files
  self.assets.reject{ |asset| asset.image? }
end

#image?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/transit/model/attachments.rb', line 17

def image?
  image.file?
end

#imagesObject

Convenience method for only finding the assets that are images



13
14
15
# File 'lib/transit/model/attachments.rb', line 13

def images
  self.assets.find_all{ |asset| asset.image? }
end

#preview_image_urlObject

Override to show a “default image” in the admin.



27
28
29
# File 'lib/transit/model/attachments.rb', line 27

def preview_image_url
  nil
end