1

I have a question about assets. There is a rails application that is running on production mode and error occurred after some folks made few changes. Error tells cannot import/load bootstrap.min so i figured it out by moving sass-rails gem to outside of assets group. Then it's working. But there is few questions: Why it's getting error inside assets group? What is the difference? (inside or outside) Is it there any other way to solve this?

Bagi
  • 181
  • 2
  • 13
  • ruby version 1.9.3p385 rails version 3.2.13 – Bagi Jul 03 '14 at 07:06
  • check your Gemfile for the line "gem rails ...". Which rails version do you use? – dre-hh Jul 03 '14 at 07:07
  • That's strange. On 3.2.13 sass-rails belongs into the assets group. Maybe it is because of you also required bootstrap-sass gem. That should be then in the asssets group either – dre-hh Jul 03 '14 at 07:13
  • i tried that. There was no difference. – Bagi Jul 03 '14 at 07:14
  • Oh i was wrong. Hm, we should check our rails 3 apps on that. See https://github.com/twbs/bootstrap-sass/issues/559. I've updated the answer – dre-hh Jul 03 '14 at 07:24

1 Answers1

1

The :asset group should contain the gems, responsible to generate assets on Rails 3.x and it was completely removed as of Rails 4.x. See why

On Rails 3 your Gemfile should be looking like this:

gem "bootstrap-sass", "~> 2.3.2.2" 

group :assets do
  gem 'sass-rails',   '~> 3.2.6'
  gem 'coffee-rails', '~> 3.2.1'
  gem "therubyracer", "~> 0.12.0", :require => 'v8'
  gem 'uglifier'
end

And in application.rb there should be the following line, which is responsible for the correctly loading of the asset gems

 Bundler.require *Rails.groups(:assets => %w(development test))
Community
  • 1
  • 1
dre-hh
  • 7,840
  • 2
  • 33
  • 44
  • ok i will check this as soon as possible and response. right now it's running on production mode so i can't stop it in short time. – Bagi Jul 03 '14 at 07:39