hzamani / acts_as_relation

Multi table Inheritance for rails
http://hzamani.github.com/acts_as_relation/
MIT License
180 stars 58 forks source link

Migrations issue #34

Closed marko07 closed 10 years ago

marko07 commented 11 years ago

Hi guys,

Am having an issue and i don't know what is going on, after i added the gem act_as_relation when i try to run the migrations am having this error

bundle exec rake db:setup rake aborted! PG::Error: ERROR: relation "products" does not exist LINE 5: WHERE a.attrelid = '"products"'::regclass ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '"products"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum

I have a product model that act as a superclass, and i have two other models than acts as products.

If i comment out the lines that calls the gem: acts_as_superclass acts_as :product

The migrations works again

what could be the error?

hzamani commented 11 years ago

What about rake db:migrate?

marko07 commented 11 years ago

That's the issue, when i try to run the migrations (rake db:migrate, rake db:setup) there comes up the error that I explained you

marko07 commented 11 years ago

Anyone has an idea what is going on?

ryanoboril commented 11 years ago

The error is saying the Products table does not exist in your postgres database. You must generate and run a migration that creates the Products table before adding acts_as :product to your subclass.

hzamani commented 10 years ago

Add an empty model in migraion