我有一个 Rails 3.2.11 应用程序,我尝试使用activerecord-postgres-hstore
gem 添加 Postgres Hstore。该应用程序可以在使用 PG-9.1.9 db 的开发中找到,但在使用 PG-9.1.8 db 的生产服务器中会出现以下错误:uninitialized constant ActiveRecord::Coders::Hstore (NameError)
日志文件如下:
独角兽日志
E, [2013-06-24T18:48:27.379430 #901] ERROR -- : reaped #<Process::Status: pid 16706 exit 1> worker=1
I, [2013-06-24T18:48:27.379703 #901] INFO -- : worker=1 spawning...
I, [2013-06-24T18:48:27.385576 #16719] INFO -- : worker=1 spawned pid=16719
I, [2013-06-24T18:48:27.385854 #16719] INFO -- : Refreshing Gem list
E, [2013-06-24T18:48:27.391198 #901] ERROR -- : reaped #<Process::Status: pid 16708 exit 1> worker=0
I, [2013-06-24T18:48:27.391379 #901] INFO -- : worker=0 spawning...
I, [2013-06-24T18:48:27.392775 #16722] INFO -- : worker=0 spawned pid=16722
I, [2013-06-24T18:48:27.392991 #16722] INFO -- : Refreshing Gem list
E, [2013-06-24T18:48:29.235072 #16712] ERROR -- : uninitialized constant ActiveRecord::Coders::Hstore (NameError)
/home/slaxman/apps/itextbook/releases/20130624183910/app/models/book.rb:7:in `<class:Book>'
/home/slaxman/apps/itextbook/releases/20130624183910/app/models/book.rb:5:in `<top (required)>'
/home/slaxman/apps/itextbook/releases/20130624183910/app/admin/books.rb:1:in `<top (required)>'
生产日志
Connecting to database specified by database.yml
书本.rb
class Book < ActiveRecord::Base
serialize :properties , ActiveRecord::Coders::Hstore
serialize :bookmark_count , ActiveRecord::Coders::Hstore
attr_accessible :title, :content, :input_method, :bookmarks_attributes, :bookmark_count, :properties
has_many :bookmarks
accepts_nested_attributes_for :bookmarks, allow_destroy: true
end
宝石文件
source 'https://rubygems.org'
gem 'rails', '3.2.11'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :production do
gem 'pg', '0.14.1'
gem 'therubyracer','0.11.4'
gem 'execjs', '1.4.0'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.6'
gem 'jquery-rails', '~> 2.2.1'
gem 'coffee-rails', '~> 3.2.2'
gem 'uglifier', '~> 1.3.0'
gem 'bootstrap-sass', '~> 2.3.1.2'
gem 'bootswatch-rails', '~> 0.5.0'
end
gem 'unicorn', '~> 4.6.2'
gem 'capistrano', '~> 2.14.2'
gem "multi_json", "~> 1.2.0"
gem 'devise' , '~> 2.2.3'
gem 'cancan', '~> 1.6.8'
gem 'kaminari', '~> 0.14.1'
gem 'kramdown', '~> 0.14.1'
gem 'nokogiri', '~> 1.5.6'
gem 'colorbox-rails', '~> 0.0.9'
gem 'coderay', '~> 1.0.8'
gem 'mercury-rails', '~> 0.9.0'
gem 'carrierwave', '~> 0.8.0'
gem 'fog', '~> 1.9.0'
gem 'activeadmin', '~> 0.5.1'
gem 'meta_search', '~> 1.1.3'
gem 'pg_hstore', '~> 0.0.1'
gem "activerecord-postgres-hstore", "~> 0.7.6"
谢谢!