Module: HasMagickTitle::Base::InstanceMethods
- Defined in:
- lib/has_magick_title.rb
Instance Method Summary collapse
- #has_magick_title? ⇒ Boolean (also: #has_image_title?)
- #magick_title_text ⇒ Object
- #refresh_magick_title(opts = {}) ⇒ Object
Instance Method Details
#has_magick_title? ⇒ Boolean Also known as: has_image_title?
45 46 47 |
# File 'lib/has_magick_title.rb', line 45 def has_magick_title? !image_title.nil? end |
#magick_title_text ⇒ Object
50 51 52 |
# File 'lib/has_magick_title.rb', line 50 def magick_title_text send [:attribute] end |
#refresh_magick_title(opts = {}) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/has_magick_title.rb', line 54 def refresh_magick_title(opts={}) self.image_title = build_image_title unless has_magick_title? if opts[:force] || (image_title.new_record? || send("#{[:attribute]}_changed?")) image_title.send(:delete_magick_title) image = MagickTitle::Image.create(magick_title_text, ) image_title.update_attributes(image.identify.merge(:filename => image.filename)) end end |