I’m still learning where methods go when writing ruby on rails applications. I read something earlier today (and had read it before) that you need to think “tell, don’t ask” when it comes to methods. So basically when working with an object, if you want it to do something, you tell it to do that. This method will then go into the model and get called with @object.method. So, in my application, after an applicant is saved. I want to send a message to the object to send email to that applicant. I had this in the controller, but now I’m pretty sure that this belongs in the model. It ends up looking like this:

def send_thanks_for_applying
    pid = fork do
      ApplicantMailer.thanks_for_applying(self).deliver
    end
  Process.detach(pid)
end

The other bit of advice (got it <a href=http://forum.thoughtbot.com/t/when-to-put-methods-in-controllers-and-when-to-put-them-in-models/705/2”>here</a>), was to put only methods that deal with session, params, request, render, redirect_to, and so on in the controller. So, if I’m not looking at info that came from the webpage or that is going to change a webpage, the method should go in the model.

Not sure that I explained this very well, but in my mind, I think I’m getting the hang of it.