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.
10 11 12 |
# File 'lib/digineo/image.rb', line 10 def file_url @file_url end |
#gallery_name ⇒ Object
Returns the value of attribute gallery_name.
11 12 13 |
# File 'lib/digineo/image.rb', line 11 def gallery_name @gallery_name end |
#image_type_name ⇒ Object
Returns the value of attribute image_type_name.
12 13 14 |
# File 'lib/digineo/image.rb', line 12 def image_type_name @image_type_name end |
Instance Method Details
#set_avatar ⇒ Object
sets the avatar flag on this image
43 44 45 46 |
# File 'lib/digineo/image.rb', line 43 def set_avatar parentmodel.avatar.unset_avatar if parentmodel.avatar update_attribute(:avatar, true) end |
#set_gallery ⇒ Object
53 54 55 56 57 |
# File 'lib/digineo/image.rb', line 53 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
59 60 61 62 63 |
# File 'lib/digineo/image.rb', line 59 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
49 50 51 |
# File 'lib/digineo/image.rb', line 49 def unset_avatar update_attribute(:avatar, false) end |