开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜