Skip to content

Instantly share code, notes, and snippets.

@rsl
Created December 6, 2012 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsl/9f1e652a8199376c1859 to your computer and use it in GitHub Desktop.
Save rsl/9f1e652a8199376c1859 to your computer and use it in GitHub Desktop.
module Foo
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def desideratum
"yup"
end
end
end
module Bar
include Foo
end
puts Bar.desideratum # => "yup"
class Baz
include Bar
end
puts Baz.desideratum # => undefined method `desideratum' for Baz:Class
@kristianmandrup
Copy link

Yes, this approach is not recommended anymore for exactly this reason. Instead, to include concerns the recommended approach is to use ActiveSupport::Concern. See fx Yehuda Katz' article about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment