Skip to content

Instantly share code, notes, and snippets.

@kirel
Created August 1, 2012 10:11
Show Gist options
  • Select an option

  • Save kirel/3225625 to your computer and use it in GitHub Desktop.

Select an option

Save kirel/3225625 to your computer and use it in GitHub Desktop.
require 'active_support/concern'
module MyCustomFoo
extend ActiveSupport::Concern
def foo_with_custom
puts 'custom'
foo_without_custom
end
included do
alias_method_chain :foo, :custom
end
end
class Foo
def foo
puts 'foo'
end
end
Foo.class_eval do
include MyCustomFoo
end
Foo.new.foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment