Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View publishes_post.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
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
View publishes_post.rb
1 2 3 4 5 6 7 8
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
Something went wrong with that request. Please try again.