Ruby:Rails:使用哪个版本的gem? [英] Ruby: Rails: Which version of a gem is used?

查看:130
本文介绍了Ruby:Rails:使用哪个版本的gem?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  gem'sqlite3','1.3。我有一个Rails 3应用程序,它在Gemfile中有以下行。 6'

然而,如果我列出我的本地宝石,我会得到:

 >宝石列表sqlite3  - 本地

***本地GEMS ***

sqlite3(1.3.6,1.3.4)

当我的Rails应用程序执行

  require 'sqlite3'

选择哪个版本的gem?是否选择了列表中的第一颗宝石?有没有办法告诉Ruby运行时使用1.3.4版本,即使安装了1.3.6版本,并由Gemfile命令?

div>

Gemfile 将指定一个版本或 Gemfile.lock 将会有版本。



示例:

Gemfile:

  gem'tiny_tds','0.5.0'

Gemfile.lock:

  tiny_tds(0.5.0)

编辑:如果您想查看版本,请使用 iltempos'建议或在 rails控制台中类型

  1.9.3p194:001> SQLite3 :: VERSION 
=> 1.3.6


I have a Rails 3 application which has the following line in the Gemfile.

gem 'sqlite3', '1.3.6'

However, if I list my local gems I get:

> gem list sqlite3 --local

*** LOCAL GEMS ***

sqlite3 (1.3.6, 1.3.4)

When my Rails apps does a

require 'sqlite3'

which version of the gem is selected? Is it that the first gem in the list is selected? Is there a way to tell the Ruby runtime to use version 1.3.4 even if version 1.3.6 is installed, and mandated by the Gemfile?

解决方案

Either the Gemfile will specify a version or Gemfile.lock will have the version.

Examples:

Gemfile:

gem 'tiny_tds', '0.5.0'

Gemfile.lock:

tiny_tds (0.5.0)

Edit: if you want to see the version, use iltempos' suggestion or in the rails console type

1.9.3p194 :001 > SQLite3::VERSION
 => "1.3.6" 

这篇关于Ruby:Rails:使用哪个版本的gem?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆