Module: MailerHelper
- Defined in:
- lib/mailer_helper.rb
Instance Method Summary collapse
Instance Method Details
#apply_radiant_layout(mailer_ivars = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/mailer_helper.rb', line 3 def apply_radiant_layout(mailer_ivars = {}) = MessagePage.new(:class_name => "MessagePage") layout = mailer_ivars[:@message_layout] layout = Layout.find_by_name(layout) unless layout.is_a? Layout .layout = layout .title = @title || @content_for_title || .title || '' .build_parts_from_hash!(extract_captures) .mailer_vars = mailer_ivars .render end |
#extract_captures ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mailer_helper.rb', line 14 def extract_captures variables = instance_variables.grep(/@content_for_/) variables.inject({}) do |h, var| var =~ /^@content_for_(.*)$/ key = $1.intern key = :body if key == :layout h[key] = instance_variable_get(var) unless key == :title h end end |