Skip to content

Instantly share code, notes, and snippets.

@tubbo
Forked from shakthimaan/Error
Created October 17, 2012 13:33
Show Gist options
  • Select an option

  • Save tubbo/3905548 to your computer and use it in GitHub Desktop.

Select an option

Save tubbo/3905548 to your computer and use it in GitHub Desktop.
UsersController
class UserDeliveryAgent
def initialize(email)
@email = email
end
def deliver!
if @email.present?
puts "Email: #{@email}"
true
else
false
end
end
end
class UsersController < ApplicationController
def display
agent = UserDeliveryAgent.new(params[:id])
if agent.delay.deliver!
render :json => { :result => "Success" }
else
render :json => { :result => "Failure" }, :status => 422
end
end
end
@jwreagor
Copy link

AKA UserDeliveryAgents#create

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment