Forum Series Part 5: Email Notifications with Rails 4.2, deliver_later, and Previews Discussion
I have no audio from 10:05 to 11:05. Is that an issue with the screencast or just a particularly reflective section? :)
Well shoot. That's definitely missing audio. I may not have the original audio to get that fixed unfortunately. Looks like I'm just explaining that you can set the anchor and your emails can link to and highlight the specific element on the page when you click the link.
Ok, that makes sense. Thanks!
Another issue I'm running into is this:
[ActiveJob] [ActionMailer::DeliveryJob] [ea357c97-e2f4-42c4-aa5f-393469e9f6b5] Performing ActionMailer::DeliveryJob from SuckerPunch(mailers) with arguments: "AdminsMailer", "job_posted", "deliver_now", gid://myapp/Job/28
^^ my console output from ActiveJob. It's showing "deliver_now" as an argument even though my code looks like this:
Jobs#create action is still waiting for these emails to be sent before redirecting.
We can no longer use `deliver_now` or `deliver_later` with preview as it will throw an Net::OpenTimeout error. "Methods must return a Mail::Message object which can be generated by calling the mailer method without the additional deliver." http://api.rubyonrails.org/...
@excid3:disqus in the send notifications method, could you sub current_user for user when subtracting from the unique list? Does [user] reflect :user in belongs_to :user relationship?
Yes it does. It's basically creating an array with one item in it and that item is the User from the belongs_to relationship. You can't do "current_user" because it's a method that's only available in the controllers and views. In the model here, we only have access to the current ForumPost record and it's associations.
@excid3:disqus thanks! One more thing: is there an implicit 'self' before forum_thread.users.uniq - users? I would think so.
The only real time you need to use "self" in the model methods is when you want to assign an attribute. Not using self will create local variables. If you're just working with the values and not changing them, you don't have to use "self".
right. I understand the reasoning as to why you didn't include it, but it is "there", correct?
Yep, I believe so. Python makes it always explicit, but it can be a little confusing in Ruby since it isn't required to access but it is require to set attributes.
Also, are smtp settings already set up here? Do we need to use mandrill or some other client that you didn't show?
Hi oliver I just installed sucker_punch so that my email should deliver later... but three days passed not delivered.. By deliver now.... it always delivered... Am I missing something???