Why did Rails4 drop support for "assets" group in the Gemfile

Solution 1:

Previously the assets group existed to avoid unintended compilation-on-demand in production. As Rails 4 doesn't behave like that anymore, it made sense to remove the asset group.

This is explained in more detail in the commit that changed that. I extracted some quotes with the actual answer.

Some gems can be needed (in production) like coffee-rails if you are using coffee templates and the fact that now assets are not precompiled on demand in production anymore.

(not precompiled on demand in production) Means that if you have that gems in production environment in 3.2.x and forget to precompile, Rails will do exactly what it does in development, precompile the assets that was requested. This is not true anymore in Rails 4, so if you don't precompile the assets using the tasks you will get a 404 when the assets are requests.

Solution 2:

Rails 4 try to force you to precompile your assets before deployment. You have to precompile your assets with

$ RAILS_ENV=production bundle exec rake assets:precompile

And why? I found this in Guide:

By default Rails assumes that assets have been precompiled and will be served as static assets by your web server.

(Source: http://edgeguides.rubyonrails.org/asset_pipeline.html#in-production)

But many time you have to use these 'assets' gems in production... for example, if you use a js.coffee file in your views directory, then Rails needs coffee compiler in production mode as well.

So I guess, the reason of this change is performance improvement... and looks more simple as well. :)

Solution 3:

We want coffeescript with AJAX (history), so coffee-rails moves out of the assets group.
sass-rails misbehaves (history), so it moves out of the assets group.

Axe the assets group.