I''ve monkey patched this behavior into a gem and I was wondering if core would be interested in a PR to add Module#prepend support to ActiveSupport#Concern. I''ll add tests of course. The code is here: https://github.com/dockyard/easy_auth/blob/master/lib/easy_auth/active_support/concern.rb My monkey patch work for what I''m trying to do but I suspect a better implementation would actually have @_dependencies be an array of arrays with each set being the module in the first element then :include or :prepend in the send. Then when `append_features` or `prepend_features` iterates over @_dependencies the send element will be used to call the proper inclusion method. The only wild card is how ClassMethods will get extended. My understanding is that extend will append class methods to the base class. I cannot seem to find a prepend version of extend. Thoughts? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Something like this would be a better implementation: https://gist.github.com/bcardarella/5735987 On Saturday, June 8, 2013 12:44:13 PM UTC-4, Brian Cardarella wrote:> > I''ve monkey patched this behavior into a gem and I was wondering if core > would be interested in a PR to add Module#prepend support to > ActiveSupport#Concern. I''ll add tests of course. > > The code is here: > > > https://github.com/dockyard/easy_auth/blob/master/lib/easy_auth/active_support/concern.rb > > My monkey patch work for what I''m trying to do but I suspect a better > implementation would actually have @_dependencies be an array of arrays > with each set being the module in the first element then :include or > :prepend in the send. Then when `append_features` or `prepend_features` > iterates over @_dependencies the send element will be used to call the > proper inclusion method. > > The only wild card is how ClassMethods will get extended. My understanding > is that extend will append class methods to the base class. I cannot seem > to find a prepend version of extend. > > Thoughts? >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Seemingly Similar Threads
- Overriding class_attribute writers and order of super/extend C.M./included block eval in ActiveSupport::Concern
- append_features(mod)
- How do you test a module that extends ActiveSupport::Concern?
- Accessing model attributes in ActiveSupport::Concern module
- Why does 'extend ActiveSupport::Concern' cause `undefined method 'recycle!'`?