简体   繁体   中英

Why are both sqlite3 and sqlite3-ruby gems referenced in the Rails 3 Gemfile?

I created a new Rails 3.0.9 project. Among other things in the Gemfile , it includes:

gem 'sqlite3'
# gem 'sqlite3-ruby', :require => 'sqlite3'

I know that the second line shown is commented out by default, but why is it included and when should it used?

I read the announcement that:

This announcement is to let you know that the sqlite3-ruby gem is being renamed to (drum roll please) "sqlite3".

Based on this announcement, I am guessing that the second line—referencing the sqlite3-ruby gem—is included for legacy purposes, but I am not certain as I'm a Ruby and Rails newbie.

As per the announcement

We will maintain backwards compatibility by releasing an empty "sqlite3-ruby" gem that depends on "sqlite3".

Therefore, using either one will essentially result in sqlite3 being installed. If it appears as sqlite3-ruby in your gemset go take a look at your Gemfile.lock and I'm sure it'll have a dependency sqlite3 .

PS since you mentioned that you're a newbie, you might be wondering what I mean by "gemset". Ruby Version Manager (RVM) is a must - you can read all about in my blog post .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM