AnApprentice
AnApprentice

Reputation: 111080

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

Upvotes: 1

Views: 294

Answers (5)

mkro
mkro

Reputation: 1892

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.

Upvotes: 0

Nathan Kleyn
Nathan Kleyn

Reputation: 5143

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.

Upvotes: 2

amit_saxena
amit_saxena

Reputation: 7624

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

Upvotes: 0

rdavila
rdavila

Reputation: 370

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.

Upvotes: 0

Spyros
Spyros

Reputation: 48706

Just use :

gem 'devise'

and you will be getting the latest stable gem :)

Upvotes: 0

Related Questions