Skip to content

Instantly share code, notes, and snippets.

@duggiefresh
Created August 23, 2013 15:33
Show Gist options
  • Save duggiefresh/6320660 to your computer and use it in GitHub Desktop.
Save duggiefresh/6320660 to your computer and use it in GitHub Desktop.
observer pattern in rails land
class EmailController < ApplicationController
def create
person.add_observer Agent.new
person.send_email 'Subject', 'Fred'
end
private
def person
@person ||= Person.new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment