I'd like to know what the best way is to send off an email when a record is created or updated specifically in the inherited_resources framework.
Right now I'm doing this:
def create
create!
UserMailer.create(object).deliver if @user.valid?
end
def update
update!
UserMailer.update(object).deliver if @user.valid?
end
It makes sense but seems a little bit clunky. I tried doing it in the success response block but that seems like a bad thing to do too. I've also tried chaining on to the update_resource and create_resource methods. They all work, but all of them don't seem very elegant.
Maybe I'm trying to minimise code too much!