activerecord-postgres-hstore
activerecord-postgres-hstore copied to clipboard
Uninitialized constant ActiveRecord::Coders::Hstore (NameError)
I have a Rails 3.2.11 app to which I tried adding Postgres Hstore using the activerecord-postgres-hstore gem. The app works find in development with PG-9.1.9 db, but gives the following error in the production server with PG-9.1.8 db:uninitialized constant ActiveRecord::Coders::Hstore (NameError)
The log files are as follows:
unicorn.log
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)>'
production.log
Connecting to database specified by database.yml
book.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
Seeing this as well.
I have managed to solve the problem by updating postgres to 9.3
Same problem with Rails 4.1.4 and Postgres 9.1.13
@kofronpi in Rails 4.1.4 hstore support is native to ActiveRecord.