Question

I have a model which uses STI:

class Contributor::Name < Contributor::NameBase
  ...
end

From this model:

class Contributor::NameBase < ActiveRecord::Base
  ...
end

Whenever Contributor::Name gets instantiated, I receive this error:

Mysql2::Error: Table 'shelflives_development.contributor_basis_name_bases' doesn't exist: SHOW FULL FIELDS FROM `contributor_basis_name_bases`

It seems that instead of looking up the table contributor_name_bases, ActiveRecord is looking up contributor_basis_name_bases. Why is adding basis between contributor and name_bases? How can I get it to stop?

Was it helpful?

Solution

Ok, it's not a answer about why rails is adding 'basis' but it will work for you.
Use set_table_name 'contributor_name_bases' in your model.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top