On Aug 6, 10:43 am, TomRossi7 <[email protected]> wrote: > Should models call action mailers, or should those calls always > originate from controllers? For example, should user.forgot_password > send the email, or should the user_controller.forgot_password? > > Just looking for some opinions...
With the caveat that I'm exactly two days into learning Ruby/Rails, I'd offer this from a purely MVC perspective. The sending of email is application functionality. The model is for business logic and data manipulation. When I think about situations like this, I consider an API. If I were developing an API that allowed a user to reset their password, would I want my code to send an email? My answer is "probably not". I'd want the application that _calls_ the API to send that email - if the developer chose to do so. That tells me that the model probably isn't the right place. Hope that helps. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

