开发者

Ruby on Rails: Do you recommend using Observers?

I notice it's used primarily for sending emails. Let's say I want to send an email after every comment is created.

Is using Observers really necessary when you could just place the Mailer.deliver_e开发者_C百科mail(user) in your comments_controller.rb's create action instead?


For proper programming practices, yes. The observers decouple the code and make sure it stays maintainable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜