Created
May 2, 2012 21:40
-
-
Save iain/2580717 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PublishesPost | |
def self.call(*args) | |
new(*args).call | |
end | |
attr_reader :post, :user | |
def initialize(post, user) | |
@post, @user = post, user | |
end | |
def call | |
post.publish(user) | |
send_notifications | |
end | |
private | |
def send_notification | |
# ... | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PublishesPost | |
def self.call(post, user) | |
post.publish(user) | |
PublicationMailer.deliver(post) # or whatever was inside .send_notifications | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment