Module: HasMagickTitle::ViewHelper

Defined in:
lib/has_magick_title/view_helper.rb

Instance Method Summary collapse

Instance Method Details

#magick_title_for(record, options = {}) ⇒ Object

Creates and HTML image tag with the options provided



5
6
7
8
9
10
# File 'lib/has_magick_title/view_helper.rb', line 5

def magick_title_for(record, options={})
  opts = record.magick_title_options[:to_html].merge(options)
  record.refresh_magick_title unless record.has_image_title? 
  return "[magick_title error]" unless record.has_image_title?
  MagickTitle::Renderer.to_html(record.magick_title_text, record.image_title.url, opts).html_safe
end