Hi --
On Thu, 6 Aug 2009, TomRossi7 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...
I keep the ActionMailer model files themselves in models/, where they
land automatically, but then allow the controller to talk to those
models as it would to any other. So I'll put this in a controller:
if params[:forgot_password]
UserNotifier.deliver_pw_help(@user)
else...
and so on. I don't think it's necessary to wrap it in another layer of
modeling. Controllers are allowed to be one step away from model
logic, and the methods to deliver are already built into the
ActionMailer models.
David
--
David A. Black / Ruby Power and Light, LLC / http://www.rubypal.com
Q: What's the best way to get a really solid knowledge of Ruby?
A: Come to our Ruby training in Edison, New Jersey, September 14-17!
Instructors: David A. Black and Erik Kastner
More info and registration: http://rubyurl.com/vmzN
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---