当前位置: 代码迷 >> Web前端 >> hobo中的承袭
  详细解决方案

hobo中的承袭

热度:249   发布时间:2012-08-31 12:55:03.0
hobo中的继承
hobo能够自动处理继承

例:从user继承employee
先建立资源
hobo g model employee birthday:date

直接更改:employee.rb
class Employee < ActiveRecord::Base

  hobo_model # Don't put anything above this

  fields do
    timestamps
  end
end
为:
class Employee < User 

  fields do
    birthdayate
  end
end
然后:生成数据库
hobo g migration
在Users表中会为你增加一个type字段
还有你继承表中增加的birthday字段

非常方便