Design decision

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

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?”

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs