Skip to content

Instantly share code, notes, and snippets.

@bruce
Created March 4, 2009 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bruce/73916 to your computer and use it in GitHub Desktop.
Save bruce/73916 to your computer and use it in GitHub Desktop.
module Sold
def self.included(base)
base.extend ClassMethods
base.instance_eval do
belongs_to :seller, :polymorphic => true
include InstanceMethods
end
end
module ClassMethods
# seller-related class methods
end
module InstanceMethods
# seller-related instance methods
end
end
TheModel.send(:include, Sold)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment