[Feature Request] Boolean methods for STI models

From the docs:

class Company < ActiveRecord::Base; end
class Firm < Company; end
class Client < Company; end
class PriorityClient < Client; end

Boolean methods would be something like:

company = Company.find(1)
company.firm?
company.client?
company.priority_client?

What about it?

Typically, when you use STI models it's because the data will be the same, but the behavior will vary. Because a different class is loaded based on the STI type, you can handle behavior polymorphically. So rather than:

if company.firm?   do_thing(company) end

You would instead do:

company.do_thing

Then each subclass of company would implement the correct behavior for that case.

For the behavior you described, you may be better served with Rails enum support: ActiveRecord::Enum Allen Madsen http://www.allenmadsen.com