Class: StiDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/cancan/sti_detector.rb

Class Method Summary collapse

Class Method Details

.sti_class?(subject) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
# File 'lib/cancan/sti_detector.rb', line 4

def self.sti_class?(subject)
  return false unless defined?(ActiveRecord::Base)
  return false unless subject.respond_to?(:descends_from_active_record?)
  return false if subject == :all || subject.descends_from_active_record?
  return false unless subject < ActiveRecord::Base

  true
end