Skip to content

Instantly share code, notes, and snippets.

@fellix
Created April 13, 2012 19:52
Show Gist options
  • Save fellix/2379642 to your computer and use it in GitHub Desktop.
Save fellix/2379642 to your computer and use it in GitHub Desktop.
Delegate them all
class Child < ActiveRecord::Base
belongs_to :parent
def method_missing method_name, *args, &block
return super unless parent.respond_to? method_name
parent.__send__ method_name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment