Vitali Zakharoff
Vitali Zakharoff

Reputation: 353

Have little problem actionmailer

Last problem in my project.

my action mailer

class Notifier < ActionMailer::Base
  def newgrants_notification(respondent)
     recipients     respondent.email
     from           "[email protected]"
     subject        "Do it"
     body        (:user => user.name, :url_base => pass_this) #i think problem is this in url?
  end
end

inquiry_model

  def pass_this
    return "http://localhost:3000/asnwer/index?user_id=#{self.id.to_i}&token=#{self.security_token}"
  end

in mailer_view

<p>Link to pass: <%= "#{@url_base}" %></p>

How to implement asnwer_form link from model to action_mailer::base? Now link is empty ;[ I need when i open my email: there was link to my path with right user_id and token

p.s - security_token in questions table user_id in users table

Upvotes: 0

Views: 107

Answers (1)

krunal shah
krunal shah

Reputation: 16339

Pass the instance of inquiry into notifier model. And access it like this !

class Notifier < ActionMailer::Base
  def newgrants_notification(respondent,inquiry_instance)
     recipients     respondent.email
     from           "[email protected]"
     subject        "Do it"
     body        (:user => user.name, :url_base => inquiry_instance.pass_this) #i think problem is this in url?
  end
end

Upvotes: 1

Related Questions