Class: KktShoppe::Attachment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- KktShoppe::Attachment
- Defined in:
- app/models/kkt_shoppe/attachment.rb
Class Method Summary collapse
-
.for(role) ⇒ Object
Return the attachment for a given role.
Instance Method Summary collapse
-
#image? ⇒ Boolean
Is the attachment an image?.
-
#path ⇒ Object
Return the path to the attachment.
Class Method Details
.for(role) ⇒ Object
Return the attachment for a given role
33 34 35 |
# File 'app/models/kkt_shoppe/attachment.rb', line 33 def self.for(role) self.where(:role => role).first end |
Instance Method Details
#image? ⇒ Boolean
Is the attachment an image?
43 44 45 |
# File 'app/models/kkt_shoppe/attachment.rb', line 43 def image? file_type.match(/\Aimage\//).present? end |
#path ⇒ Object
Return the path to the attachment
38 39 40 |
# File 'app/models/kkt_shoppe/attachment.rb', line 38 def path file.url end |