Class: Digineo::Image
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Digineo::Image
- Defined in:
- lib/digineo/image.rb
Overview
require ‘RMagick’
Instance Attribute Summary collapse
-
#file_url ⇒ Object
Returns the value of attribute file_url.
-
#gallery_name ⇒ Object
Returns the value of attribute gallery_name.
-
#image_type_name ⇒ Object
Returns the value of attribute image_type_name.
Instance Method Summary collapse
-
#set_avatar ⇒ Object
sets the avatar flag on this image.
- #set_gallery ⇒ Object
- #set_image_type ⇒ Object
-
#unset_avatar ⇒ Object
removes avatar flag.
Instance Attribute Details
#file_url ⇒ Object
Returns the value of attribute file_url.
11 12 13 |
# File 'lib/digineo/image.rb', line 11 def file_url @file_url end |
#gallery_name ⇒ Object
Returns the value of attribute gallery_name.
12 13 14 |
# File 'lib/digineo/image.rb', line 12 def gallery_name @gallery_name end |
#image_type_name ⇒ Object
Returns the value of attribute image_type_name.
13 14 15 |
# File 'lib/digineo/image.rb', line 13 def image_type_name @image_type_name end |
Instance Method Details
#set_avatar ⇒ Object
sets the avatar flag on this image
44 45 46 47 |
# File 'lib/digineo/image.rb', line 44 def set_avatar parentmodel.avatar.unset_avatar if parentmodel.avatar update_attribute(:avatar, true) end |
#set_gallery ⇒ Object
54 55 56 57 58 |
# File 'lib/digineo/image.rb', line 54 def set_gallery return if gallery_id or gallery_name.to_s.empty? self.gallery_id = parentmodel.find_or_create_gallery(gallery_name).id save end |
#set_image_type ⇒ Object
60 61 62 63 64 |
# File 'lib/digineo/image.rb', line 60 def set_image_type return if image_type_id or image_type_name.to_s.empty? self.image_type_id = ImageType.find_or_create_by_name(image_type_name).id save end |
#unset_avatar ⇒ Object
removes avatar flag
50 51 52 |
# File 'lib/digineo/image.rb', line 50 def unset_avatar update_attribute(:avatar, false) end |