mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
fixes #165 avoid overwriting AR::Base inherited method
Kaminari can now coexist with other gems that defines `inherited`
This commit is contained in:
parent
83ce8a456f
commit
5894d6805e
1 changed files with 6 additions and 3 deletions
|
@ -5,9 +5,12 @@ module Kaminari
|
|||
extend ActiveSupport::Concern
|
||||
included do
|
||||
# Future subclasses will pick up the model extension
|
||||
def self.inherited(kls) #:nodoc:
|
||||
super
|
||||
kls.send(:include, Kaminari::ActiveRecordModelExtension) if kls.superclass == ActiveRecord::Base
|
||||
class << self
|
||||
def inherited_with_kaminari(kls) #:nodoc:
|
||||
inherited_without_kaminari kls
|
||||
kls.send(:include, Kaminari::ActiveRecordModelExtension) if kls.superclass == ActiveRecord::Base
|
||||
end
|
||||
alias_method_chain :inherited, :kaminari
|
||||
end
|
||||
|
||||
# Existing subclasses pick up the model extension as well
|
||||
|
|
Loading…
Add table
Reference in a new issue