I'm getting an error when running db:migrate 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:migrate
(in /Users/myuser/src/test)
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:migrate, it fails:

$ rake db:migrate
(in /Users/myuser/src/test)
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?

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to