I'm trying send flash messages and welcome notices to users if it's their first time commenting; basically, something like this:
class CommentObserver < ActiveRecord::Observer
def after_save(comment)
if comment.user.new?
Mailer.deliver_welcome_package(comment)
flash[:notice] = "Welcome! We just delivered a welcome package to your email"
end
end
end
I'm not sure how I should display that flash message for users after they create their first comment. Should I put that flash message in the controller (with an additional "if comment.user.new?") or is there a way to display the flash message more efficiently?