I had an annoying bug in my app which caused static code to apear in my HTML. After a long time of bug hunting and trying things I finally found what caused the error.
The problem lies in the sprocket version. In my Gemfile.lock I have
sprockets 3.2.0)
and then my App works fine. But when I do bundle update
the version changes to
sprockets (2.12.4)
and the bug appears. So now I have to manually change the sprocket version to 3.2.0 after I do bundle update.
So why does bundle update change my sprocket version to an older version? I am using the latest version of Bundler.
UPDATE.
I've just added the capistrano gem to my gemfile
gem 'capistrano', '~> 3.1.0'
gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1.1'
# Add this if you're using rbenv
gem 'capistrano-rbenv', github: "capistrano/rbenv"
And tried to do bundle install but now I'm getting another error,
Bundler could not find compatible versions for gem "sprockets":
In snapshot (Gemfile.lock):
sprockets (= 3.2.0)
In Gemfile:
sprockets (< 4.0, >= 2.8) ruby
angular-rails-templates (>= 0) ruby depends on
sprockets (~> 2) ruby
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
I run bundle update
and while the error is fixed the bug with the static HTML is back since bundler downgraded the gem back to sprockets (2.12.4).
Changing the sprocket back to 3.2.0 in the Gemfile.lock fixes the bug. But there has to be an explanation for this behaviour. Right?