I'm getting an error when running db:setup
for my Hobo project with a clean database. I have two models, A and B, where B extends A through single-table-inheritance. Creating everything works. But if I start with a fresh database, rake fails with an error:
$ rake db:setup
...
rake aborted!
Table as does not exist
Here are the steps I went through to reproduce this. First, create the Hobo app:
$ hobo testproject
Create the first model, A
:
$ ruby script/generate hobo_model_resource a name:string type:string
Setup database.yml, generate and execute the migration:
$ ruby script/generate hobo_migration
Create the second model, B
:
$ruby script/generate hobo_model_resource b
Edit the B
model to extend 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
Generate and run the migration:
$ ruby script/generate hobo_migration
Voila. All works fine. Now, if I delete all the tables and run db:setup
, it fails:
$ rake db:setup
...
rake aborted!
Table as does not exist
Following the suggestions at http://stackoverflow.com/questions/646391/ruby-on-rails-single-table-inheritance-sti-and-unit-test-problem-with-postgres, I tried removing test/fixtures/as.yml
and test/fixtures/bs.yml
, but that didn't help.
hobo 0.9.103
rails 2.3.5
rake 0.8.7
jruby 1.4.0RC1
Any suggestions?