Check gem version number

Viewed 28793

My setup: Rails 3.0.9, Ruby 1.9.2

I want to check the gem version for my app through the Rails console. In my gemfile, I have

gem 'rack', '1.2.3'

Ran bundle install after. In the Rails console,

>> Rack.version
=> "1.1"

Any idea why?

UPDATE

Gemfile.lock

GEM
  remote: http://rubygems.org/
  specs:
    actionpack (3.0.9)
      ...
      rack (~> 1.2.1)
      ...

    rack (1.2.3)

    rack-mount (0.6.14)
      rack (>= 1.0.0)

    warden (1.0.4)
      rack (>= 1.0)

DEPENDENCIES
...  
rack (= 1.2.3)
...

There are several rack versions listed in gemfile.lock.

4 Answers

Every gem has ::VERSION constant.. so just use Rack::VERSION or OpenSSL::VERSION in console which should give you the version of gem loaded in that console.

we can use bundle list or bundle show to list all Gems included by the bundle.

Related