Can someone please help me understand the results that are being produced when doing queries on a table that is using single inheritance.
Table1 < ActiveRecord::Base Role1 < Table1 Role2 < Table1 Role3 < Table1
1. Role1.find(:all) produces: "SELECT * FROM table1 WHERE type = 'Role1'"
2. any other find on table1 that calls anything but the Role1 Class
EXAMPLES. Table1.find(:all) or Table1.find(:all, :conditions => ['type = "Role2"]
3. After doing a find like one of the examples from step 2, then do the original find from step one. (Role1.find(:all)) This now produces the following MySQL:
SELECT * FROM Table1 WHERE type = 'Role1' or type = 'Role2' OR type = 'Role3'
Can someone please help shed some light on what is going on here. Specifically why is the sql different for the same query??? Thanks