Skip to content

Instantly share code, notes, and snippets.

@maxwell
Created February 5, 2011 00:19
Show Gist options
  • Save maxwell/812057 to your computer and use it in GitHub Desktop.
Save maxwell/812057 to your computer and use it in GitHub Desktop.
module HasPersonProxy
module ClassMethods
def always_has_one_person
self.instance_eval do
has_one :person
include InstanceMethods
alias_method_chain :person, :proxy
end
end
def always_belongs_to_person
self.instance_eval do
belongs_to :person
include InstanceMethods
alias_method_chain :person, :proxy
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment