lib/easy_presenter.rb in easy_presenter-1.0.1 vs lib/easy_presenter.rb in easy_presenter-1.1.0
- old
+ new
@@ -4,20 +4,25 @@
module EasyPresenter
extend ActiveSupport::Concern
included do
- easy_presenter_subclass
+ include_easy_presenter
end
module ClassMethods
+ def inherited(subclass)
+ include_easy_presenter(subclass)
+ super
+ end
+
protected
- def easy_presenter_subclass
- presenter_class = "#{self}Presenter".safe_constantize
+ def include_easy_presenter(klass=self)
+ presenter_class = "#{klass}Presenter".safe_constantize
if presenter_class
presenter_class.extend ActiveSupport::Concern
- include presenter_class
- include Base
+ klass.send :include, presenter_class
+ klass.send :include, Base
end
presenter_class
end
end
\ No newline at end of file