FIX: catch NoMethodError during precompile_css too (PR #9940)

Ran into this on heroku:

NoMethodError: undefined method `enabled?' for #<Theme:0x0000558f069e7718>
vendor/bundle/ruby/2.6.0/gems/activemodel-6.0.1/lib/active_model/attribute_methods.rb:431:in `method_missing'
app/models/theme.rb:155:in `block (2 levels) in transform_ids'
vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/delegation.rb:85:in `each'
vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/delegation.rb:85:in `each'
vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/query_methods.rb:260:in `select'
vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.1/lib/active_record/relation/query_methods.rb:260:in `select'
app/models/theme.rb:155:in `block in transform_ids'
app/models/theme.rb:105:in `get_set_cache'
app/models/theme.rb:140:in `transform_ids'
app/models/theme.rb:321:in `list_baked_fields'
app/models/theme.rb:317:in `resolve_baked_field'
lib/stylesheet/manager.rb:289:in `theme_digest'

GitHub

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This does not seem like the right fix to me. It’s a catch all that could sweep up many other things.

Do you know why the method doesn’t exist? Is a migration missing or something?

Do you know why the method doesn’t exist? Is a migration missing or something?

The migrations have not been run, as mentioned in the line below.

you are precompiling prior to running migrations

Yeah it is certainly rare to be eating exceptions but in this case I am fine with it cause we both print out clearly that we skipped them and handle this automatically anyway in runtime if for some reason the precompile fails. This is also super scoped to the rake task.

An alternative here would be to confirm theme schema matches exactly what we want, but wiring that up would be pretty complex.