Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7167141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:31:47+00:00 2026-05-28T14:31:47+00:00

I have an application (rails 3.2) with haml (3.1.4) emails. In the email template

  • 0

I have an application (rails 3.2) with haml (3.1.4) emails. In the email template I wanted to use link_to, but apparently none of those 4 is working in production:

#{link_to(my_models_url)}
= link_to(my_models_url)

/ @url set to my_models_url
#{link_to(@url)}
= link_to(@url)

On development mode everything works fine, but in production, I keep getting the following error:

No route matches {}
 actionpack (3.2.0) lib/action_dispatch/routing/route_set.rb:503:in `raise_routing_error'

It works when I use helper methods before:

/ @my_link set to link_to(my_models_url)
#{@my_link}
= @my_link

But this is not convenient, if there are more links in the email and in general I don’t see why any of the first 4 options should not be ok. I have no idea where is this problem comming from. I would appreciate any help on this…

SOLUTION:

Thanks to iWasRobbed I found where my problems were:

  1. all {resource}_path and {resource}_url have to be set in mailers as @variables, they are not available in mailer views
  2. apparently link_to() method in mailer is not the same as in rails views… it always needs 2 arguments, so instead of link_to(@link) available in views, one needs to do link_to(@link,@link). Pffff…
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:31:48+00:00Added an answer on May 28, 2026 at 2:31 pm

    You need to declare the URL within the mailer.rb file. This isn’t a HAML issue so much as it’s just the way ActionMailer was designed.

    def some_mailer_here
      @url = my_models_url
    end
    

    Then in your mailer view you can do:

    = link_to("My models URL", @url)
    

    http://guides.rubyonrails.org/action_mailer_basics.html#generating-urls-in-action-mailer-views

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Ruby on Rails application that is using HAML based template views.
I am using haml with my rails application and i have a question how
This is a Rails 3 application with HAML. I have the following: = f.fields_for
I have a Rails app (v2.3.8) using HAML (v3.0.25). My application.html.haml currently has the
I have several partials that I'm including in my Rails application.html.erb file , but
I have a Ruby application (not using Rails) that use my own Ruby gems.
I am building a Rails application that contains Developer s who have Application s.
I have Rails application with mounted Engine. #{main_app}/config/routes.rb mount CommentIt::Engine => /talk, :as =>
I have rails application running in linode server .Some guy is continuously spamming (writing
I have a Rails application that accepts file uploads of CSV files. When developing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.