Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure when executing "RAILS_ENV=production rake assets:precompile --trace" #48

Closed
xeospeed opened this issue Sep 27, 2013 · 1 comment

Comments

@xeospeed
Copy link

When trying to deploy my application I ran into a failure whenever I tried to precompile my assets for production, receiving an error:

** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
rake aborted!
PG::UndefinedTable: ERROR: relation "part_models" does not exist
LINE 5: WHERE a.attrelid = '"part_models"'::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 = '"part_models"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum

I was able to trace the offending code to my model which was calling:

"acts_as :part_model, :as => :partable"

After a bit of troubleshooting I discovered a workaround was to just check if the table exists:

if ActiveRecord::Base.connection.table_exists? 'part_models'
acts_as :part_model, :as => :partable
end

This works but feels a bit hacky.

@xeospeed
Copy link
Author

It appears this may be related to eager_loading as mentioned in rails/rails#11389

Once Rails 4.0.1 is released, is setting eager loading to false the preferred solution to this problem?

@hzamani hzamani closed this as completed Jul 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants