1

I read in this amazing article that I should save my RAM by adding gems to the :assets group.

So I tried to do that:

group :assets do
  gem 'sass-rails'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'coffee-script-source', '1.5.0'
  gem 'uglifier', '>= 1.0.3'

  # Front-end
  gem 'jquery-rails'
  gem 'bootstrap-sass'
end

But then I get this error, when pushing to heroku:

Sprockets::FileNotFound in Me#index

Showing /app/app/views/layouts/application.html.haml where line #58 raised:

couldn't find file 'jquery'
  (in /app/app/assets/javascripts/libs/libs.js:4)
Extracted source (around line #58):

55: 
56:   / %script{src: "//api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.js"}
57: 
58:   = javascript_include_tag 'libs/libs'
59:   %script{:src => "http://js.pusher.com/2.1/pusher.min.js", :type => "text/javascript"}
60:   %script{:src => "//cdn.jsdelivr.net/modernizr/2.7.1/modernizr.min.js", :type => "text/javascript"}
61:   %script{:src => "//cdn.jsdelivr.net/webshim/1.11.0/polyfiller.js", :type => "text/javascript"}

And I read here that it is normal, as :assets means pretty much :development + :test

How can I tell Heroku that I'd like a specific gem to be loaded on assets precompilation, but not during runtime anymore?

I use Rails 3.2.

Thanks for support

Community
  • 1
  • 1
Augustin Riedinger
  • 20,909
  • 29
  • 133
  • 206
  • What version of Rails are using? Also where at the assets located? This can cause problems too. Just as a future FYI the assets group has been removed in Rails 4. You can use the :production, :development, :testing groups to organize the gems and keep dev gems from being bundled into your production application. – dbslone Feb 26 '14 at 18:31
  • Using Rails 3.2. I read it was removed in Rails 4. But I'm not sure I understand the point the `:assets` group if it is not to precompile them before going to production. Is there a possibility to mention that these gems are only necessary at this step, and not on runtime? – Augustin Riedinger Feb 27 '14 at 09:41
  • regardless I don't think the problem is in your gem file. Have you checked your application.js to make sure jQuery is listed in this file? – dbslone Feb 28 '14 at 01:12
  • Yes, it is: earlier and now again, I moved the jQuery gem out of the `:assets` group and it's working again. – Augustin Riedinger Feb 28 '14 at 08:44

0 Answers0