ruby on rails 3 - Helper methods available in mailer views depend on environment? -



ruby on rails 3 - Helper methods available in mailer views depend on environment? -

related previous question still have 1 thing understand - why this:

= link_to(root_path) = link_to(@some_path_set_in_mailer)

works in development mode (config.action_mailer.perform_deliveries set true , emails sent) , in production or staging has changed to:

= link_to(@some_path_set_in_mailer, @some_path_set_in_mailer)

to avoid "no route matches {}" error?

i had problem in rails 3.2.

i'm not exclusively sure why there difference since there shouldn't be.

however, link_to typically has format:

= link_to("some link description here", root_path)

the time typically leave off link description text if have longer description need set within do block this:

= link_to(root_path) %p link description here = image_tag("some_image.jpg")

so recommend sticking preferred syntaxes above.

the docs link_to don't talk short-hand method you're using much.

here source it:

# file actionpack/lib/action_view/helpers/url_helper.rb, line 231 def link_to(*args, &block) if block_given? options = args.first || {} html_options = args.second link_to(capture(&block), options, html_options) else name = args[0] # issue coming options = args[1] || {} html_options = args[2] html_options = convert_options_to_data_attributes(options, html_options) url = url_for(options) href = html_options['href'] tag_options = tag_options(html_options) href_attr = "href=\"#{erb::util.html_escape(url)}\"" unless href "<a #{href_attr}#{tag_options}>#{erb::util.html_escape(name || url)}</a>".html_safe end end

ruby-on-rails-3 actionmailer email-templates

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -