Search code examples
jqueryruby-on-rails-3gemfile

Why is 'jQuery-Rails' often outside of the asset group


Why is it that I often see gem 'jquery-rails outside of the :assets group?

group :assets do
  gem 'sass-rails', " ~> 3.1.0"
  gem 'coffee-rails', " ~> 3.1.0"
  gem 'uglifier'
end

gem 'jquery-rails'

Will there be buggy behavior if I put it inside?

Thanks!


Solution

  • The jquery-rails gem provides some test helpers also. So perhaps for that reason people prefer to put it outside the :assets group.

    However, the :assets group is included in development and testing environment, so you should be perfectly safe to place jquery-rails in your :assets group if you like.

    Just make sure you precompile your assets before you deploy your application.