How do I update rack when using rails 3? Bundler won't let me!
I'm getting the following error when using a file_field_tag: EOFError (bad content body). This is a known error, and the solution is to update rack-mount.
Unfortunately, if I run "bundle update rack-mount" I get the following error:
Bundler could not find compatible versions for gem "rack-mount":
In Gemfile:
开发者_运维百科 rails (= 3.0.7) depends on
rack-mount (~> 0.6.14)
rack-mount (0.7.2)
This is infuriating because everyone tells me that bundler is so awesome but all it's done is make it literally impossible for me to run the version of the gem that I need to. Grr.
Anyone know how to fix this? I'm surprised I haven't found anything else on Google about this, since as it stands it's impossible to upload files using rails 3.
It seems rails version 3.0.7 depends on rack-mount version 0.6.14, try to edit gem 'rails', '3.0.x'
in your Gemfile. Where x is the other version number which can be 6, 5, 4 or anything that you'll prefer to use instead of 7 then delete your Gemfile.lock and try bundle install
.
You can't overwrite the Rails dependancies using bundler. If you must overwrite the Rails requirements, you should maintain your own branch.
- Fork Rails on github (say version 3.0.9)
- Check it out (via
git clone
) - Checkout branch you want to change (
git checkout --track origin/3_0_9
) - Make a new branch (
git checkout -b 3_0_9_with_new_rack_mount
) - Make the change. In this case, edit actionpack/actionpack.gemspec and change
0.6.14
to0.7.2
- Commit the change (
git commit -am "Updated to a newer rack-mount version"
) - Push it to your github account (
git push origin 3_0_9_with_new_rack_mount
) - Update your Gemfile with that repository (
gem 'rails', :git => "git://github.com/jevy/rails.git", :branch => "3_0_9_with_new_rack_mount" # Fixes carrierwave error)
- Delete your Gemfile.lock
bundle install
- Profit $$$
Did you try deleting Gemfile.lock
and running bundle install
again?
精彩评论