design decision

2 views
Skip to first unread message

ssmithstone

unread,
Sep 27, 2010, 8:29:12 AM9/27/10
to Ruby on Rails: Talk
Trying to make my controllers as skinny as possible , so come across a
design issue if I want to send out an email when a model is created
would I put this functionality on the after_create method or inside of
the controller after the #save method

Ar Chron

unread,
Sep 27, 2010, 9:03:51 AM9/27/10
to rubyonra...@googlegroups.com
If I understand the requirement, then the creation of an e-mail is the
business of the model.

Controller should be deciding "After creation of model X, what view does
the user see? To the index view, the show view of the model just
created, or back to the view the user was at before creating the model?"

--
Posted via http://www.ruby-forum.com/.

radhames brito

unread,
Sep 27, 2010, 1:40:35 PM9/27/10
to rubyonra...@googlegroups.com

on the model , if it happens often(if you are sending lots of mails) use a plugin to send it to another thread, and you can also use observers.

ssmithstone

unread,
Sep 28, 2010, 6:06:34 AM9/28/10
to Ruby on Rails: Talk
I picked up the spawn plugin to thread the mailer and will go with
moving the business logic to the model cheers for the input guys
Reply all
Reply to author
Forward
0 new messages