我正在运行bundle install
时收到以下消息Your Gemfile lists the gem sqlite3 (= 1.3.5) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem rspec-rails (= 2.10.0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem rspec-rails (= 2.10.0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem pg (= 0.12.2) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
我在Heroku中使用Postgresql,我相信我在开发和测试中都使用Postgresql。我最近从sqlite迁移/切换到postgresql。
我是否还需要sqlite3 gems:development或in:development,:test?
最后,开发与开发之间是否存在差异? :开发,:测试?
的database.yml
development:
adapter: postgresql
encoding: unicode
database: xxxxxx_development
pool: 5
username: xxxxxx
password:
test:
adapter: postgresql
encoding: unicode
database: xxxxxx_development
pool: 5
username: xxxxxx
password:
的Gemfile
gem 'rails', '3.2.11'
gem "bootstrap-sass"
gem 'will_paginate'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'pg', '0.12.2'
gem 'pg_search'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.10.0'
gem 'guard-rspec', '0.5.5'
end
group :development do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.10.0'
end
# Test gems on Macintosh OS X
group :test do
gem 'rspec-rails', '2.10.0'
end
group :production do
gem 'pg', '0.12.2'
gem 'rack-google_analytics'
end
答案 0 :(得分:4)
您正在重复将sqlite放入开发组:
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.10.0'
gem 'guard-rspec', '0.5.5'
end
group :development do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.10.0'
end
您可以在此处删除您的第二个开发组列表,因为它没有添加任何内容 - 您已经在第一个语句中将它们放入开发和测试中。同样地,通过将pg放在任何组之外,它可以在所有组中使用,因此将其添加到生产中是一个重复的列表。
重写宝石文件可能是:
gem 'rails', '3.2.11'
gem "bootstrap-sass"
gem 'will_paginate'
gem 'bootstrap-will_paginate', '0.0.6'
# gem 'pg', '0.12.2'
gem 'pg_search'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.10.0'
end
group :test do
gem 'guard-rspec', '0.5.5'
end
group :production do
gem 'pg', '0.12.2'
gem 'rack-google_analytics'
end
另外,一个感受到痛苦的人的一个友好提示:尝试在开发中使用相同的db作为生产。我知道最初在本地设置postgres可能会很棘手,但是一旦它在那里它就会坚如磐石并且非常容易使用。由于PG和SQLite实现之间的差异(例如,在字段iirc中搜索文本),您将面临更少的错误风险。
没有sqlite:
gem 'rails', '3.2.11'
gem "bootstrap-sass"
gem 'will_paginate'
gem 'bootstrap-will_paginate', '0.0.6'
gem 'pg', '0.12.2'
gem 'pg_search'
group :development, :test do
gem 'rspec-rails', '2.10.0'
end
group :test do
gem 'guard-rspec', '0.5.5'
end
group :production do
gem 'rack-google_analytics'
end
答案 1 :(得分:1)
如果你在所有环境中使用pg而不是删除sqlite3 gem。
之间的区别:开发与发展:开发,:测试是:开发,:测试是针对需要包含在这两种环境中的宝石。 :开发是为了:开发唯一的宝石。
答案 2 :(得分:1)
你有宝石sqlite3,pg,respec-rails多一次在相同的环境中,你需要删除相同的宝石的重复。
按如下方式编辑您的gem文件:
gem 'rails', '3.2.11'
gem "bootstrap-sass"
gem 'will_paginate'
gem 'bootstrap-will_paginate', '0.0.6'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.10.0'
gem 'guard-rspec', '0.5.5'
end
group :production do
gem 'pg', '0.12.2'
end