I am working on someone else’s code. They have a column in the Account table called “type” that records what type of account the user has (paid, free etc). Now, I’m trying to make a db call via active record like so:
<%= Account.count(:conditions => ["type = ?", "AccountDemo" ]) %>
however, it is telling me the column is not found. Is that because he used the word “type” and that is not allowed? What am I doing wrong?
“type” is a special column name that is generally used with Single Table Inheritance. If you are not using STI, then the first thing you should do is to rename that column. If you are using STI, then you should be doing
rather than working with the superclass directly.