If I have 3 classes like below:
class Parent < ActiveRecord::Base
end
class Child < Parent
end
class Another::Child < ::Child
end
All those 3 classes are located in different folders.
In rails console, Child.first
run this query SELECT parents.* FROM parents WHERE parents.type IN ('Child') ORDER BY parents.id ASC LIMIT 1
.
After that, I run Another::Child.first
in rails console and this query is generated SELECT parents.* FROM parents WHERE parents.type IN ('Another::Child') ORDER BY parents.id ASC LIMIT 1
.
After I run both command in rails console, then I run Child.first
again and the query became SELECT parents.* FROM parents WHERE parents.type IN ('Child', 'Another::Child') ORDER BY parents.id ASC LIMIT 1
.
What is the cause of that?
How to consistently call the 3rd query whenever I run Another::Child.first
considering Another::Child
is a child class of Child
?