简体   繁体   中英

Upgraded ruby from 1.9.3 to 2.1.6, active_admin throws NoMethodError (active_admin.css.scss)

After upgrading my app from ruby 1.9.3 to 2.1.6, accessing my Active Admin-powered admin interface threw the following error:

NoMethodError - undefined method 'empty?' for nil:NilClass (in /Users/myusername/Rails/myapp/app/assets/stylesheets/active_admin.css.scss)

I replicated this error when simply accessing an Active Admin page, and when doing a rake assets:precompile (which happens during a deploy as well).

I tried completely commenting out the contents of active_admin.css.scss , to no avail. My relevant gem versions:

  • activeadmin (0.5.1)
  • sass (3.4.13)
  • sass-rails (3.2.6)
  • bootstrap-sass (2.1.1.0)
  • rails (3.2.21)

What happened between ruby 1.9.3 and 2.1.6 that might be causing this error with stylesheets?

According to this thread , sass gem 3.1.18 is the first SASS gem release with ruby-2.x compatibility. This led me down the path of upgrading my sass-rails gem from 3.2.4 to 3.2.6, which as a dependency upgraded my sass gem to 3.4.13 (was 3.1.15).

And that did it! No more obscure errors related to active_admin.css.scss or css in general.

UPDATE

sass-rails didn't really need to be updated. Just the sass gem solves the problem (also, upgrading sass-rails inexplicably broke some javascript in the app, specifically it triggered the error History.js Core has already been loaded... found in jquery.history.js).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM