Liz
Liz

Reputation: 1437

Using `_path` in Rails Mailer

I'm currently working with a mailer in which I need to link an index view. In my app, this is reachable by reminders_path, but when I used that in my mailer (<%= link_to "Memory Enhancer", reminders_path %>) the link didn't work.

After some googling and some SO searches, most things seemed to recommend something like this:

<%= link_to "Take Me To My Memory Enhancer", Rails.application.routes.url_helpers.url_for(controller: "reminders", action: "index") %>

However, the link still isn't functional. What is the "proper" rails way to do this?

Upvotes: 1

Views: 984

Answers (1)

j-dexx
j-dexx

Reputation: 10406

Use reminders_url, as you want a full url, not just the path.

Upvotes: 5

Related Questions