I create a mail which works fine as long as I do not add a link inside the body. I am looking to have an email that is send to a recipient once a message is directed to him on the platform.
<%= link_to "See message", @message %>
does not seem to work. Is there a specific approach for the problem ? All what I saw so far is not very clear.
The error message is :
ActionController::UrlGenerationError in Rails::Mailers#preview
Message-mailer.rb file :
class MessageMailer < ApplicationMailer
def new_message(message)
@message = message
@title = message.title
@from_first_name = User.find_by_id(message.user_id).first_name
@from_last_name = User.find_by_id(message.user_id).last_name
mail to: @message.user.email,
subject: "New Message: #{@message.title}"
end
end