Rails - Understanding Gems
I'm using the rails devise gem. I noticed a case sensitivity bug which turns out is fixed in the latest version of devise so I'm thinking about upgrading.
In my gem file I have:
gem 'devise', '~> 1.1.3'
When I run bundle I get:
Using devise (1.1.9)
Why the difference. And what setting should I be using in my gem file to upgrade开发者_开发知识库 to the latest and greatest?
Thanks
The ~>
in your Gem declaration says that Bundler can install any version up to the next major version, so in this case it could install any version of devise that is => 1.1.3 and < 1.2.0.
Including the ~>
is good practice, as it means security updates are automatic if the gem is using versioning correctly; in a production environment, you'll probably want to drop this moniker, though, and just set your gem versions statically to avoid issues.
To update to the latest version of the gem, everytime, just use the following with no second version argument:
gem 'devise'
See more information on the Gemfile format at http://gembundler.com/gemfile.html.
Just use :
gem 'devise'
and you will be getting the latest stable gem :)
The difference is because you're telling to Bundler to use 1.1.3 or a major version of this gem in you system, if you want to use a specific version just put '1.1.9' in the version param.
use bundle update devise
to update the devse gem and bundle update
to update all the gems (which is not advisable)
http://jsbin.com/ihiqe4
if you know the version number you want, try this (assuming it's 1.2.3):
gem 'devise', '1.2.3'
or just leave out the version number
if it has not been released yet, you can point to it's github repository instead.
精彩评论