我在为我的Hobo项目运行db:setup
时出现错误,它带有干净的数据库。我有两个模型,A和B,其中B通过单表继承来扩展A.创建一切正常。但是,如果我从新的数据库开始,耙机将失败,并显示以下错误:Rails和Hobo单表继承问题
$ rake db:setup
...
rake aborted!
Table as does not exist
以下是我重现此问题的步骤。首先,创建流浪汉应用:
$ hobo testproject
创建的第一款车型,A
:
$ ruby script/generate hobo_model_resource a name:string type:string
设置的database.yml,生成并执行迁移:
$ ruby script/generate hobo_migration
创建第二个模型,B
:
$ruby script/generate hobo_model_resource b
编辑B
模型扩展A
:
class B < A
# --- Permissions --- #
def create_permitted?
acting_user.administrator?
end
def update_permitted?
acting_user.administrator?
end
def destroy_permitted?
acting_user.administrator?
end
def view_permitted?(field)
true
end
end
生成并运行迁移:
$ ruby script/generate hobo_migration
瞧。一切正常。现在,如果我删除所有表和运行db:setup
,它失败:
$ rake db:setup
...
rake aborted!
Table as does not exist
在Ruby on Rails Single Table Inheritance (STI) and unit test problem (with PostgreSQL)继建议,我试图消除test/fixtures/as.yml
和test/fixtures/bs.yml
,但这并没有帮助。
流浪汉0.9.103
轨2.3.5
耙0.8.7
的JRuby 1.4.0RC1
有什么建议?
请注意,这是修正于2010年1月24日,并在最新的候选版本。 – organicveggie 2010-02-11 16:34:58