I faced this issue while developing a feature.Lets say there is following code:
case 1:
module Person
module Employee
class Officer
def self.print_class(obj)
obj.is_a? Employee
end
end
end
end
case 2:
class Person::Employee::Officer
def self.print_class(obj)
puts obj.is_a? Employee
end
end
class Employee < ActiveRecord::Base
end
emp = Employee.last
and we have model Employee . Now
For case 1: Person::Employee::Officer.print_class(emp) gives "false"
For case 2: Person::Employee::Officer.print_class(emp) gives "true"
Why is this happening?