So let’s try to implement a service object that will create a Post , and nothing else — and then, depending on the result of that creation, it’s going to publish some sort of Success or Failure message.

Ok, so if post.save returns true, we broadcast post_created string, together with the Post object we just created — but if post.save returns false, we broadcast post_not_created string. Sounds easy so far. Let’s hook it up into our PostsController

This looks promising, but we’re missing something important here. Every Rails controller should have some sort of redirect_to or render , right? Let’s use the messages that Services::Post::Create broadcasts, and let’s add that back to our controller. We’re going to use the on method that comes from whisper.

Better, but there are still two pieces missing. Our original controller was also sending email notification and creating a FeaturedPost object, and this controller does not. And we don’t want to put that inside that controller, because this is exactly what we’re trying to avoid.