How can I create activerecord models that are subsets of a certain model?
I've seen this before but can开发者_StackOverflow't figure out what the correct term is. Basically, I'd like to create models for a specific subset of table data. E.g. (these are not the real classes)
class Person < ActiveRecord::Base
class Man < Person
<something here> :gender => 'male'
If you are trying to create a single table inheritance, than I am fairly certain that this is the correct syntax. Just don't forget to define the type
field in the table.
class Person < ActiveRecord::Base
end
class Man < Person
end
Edit: Removed the
精彩评论