Ruby on Rails Friday, October 6, 2017

oh, it wasn't too hard.

I followed most of this -> http://guides.rubyonrails.org/action_mailer_basics.html

basically generated a mailer 

'rails generate mailer Interview_Notification'

it created the mailer(s) and views I needed.



class InterviewNotificationMailer < ActionMailer::Base

default from: "jguerra@jginfosys.com"

# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.interview_notification_mailer.interview_request.subject
#
def interview_request
@greeting = "Hi, you have an interview request."

mail to: "jguerra@jginfosys.com", subject: "Interview request!"
end

end


In my Interviews controller, in the create def, if the interview request is saved... I fired off the mailer...
InterviewNotificationMailer.interview_request.deliver    I didn't make any changes to the mailer view.  You have to make sure you call the mailer correctly (the class, followed by def, and the action (.deliver))

That's it.


On Friday, October 6, 2017 at 12:20:18 PM UTC-4, Mugurel Chirica wrote:
You can post your solution, maybe it will help others in the future.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b20340ec-b657-47bc-9e85-aa51adc7dfc5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment