DataMapper support for PostgreSQL HSTORE and ARRAY types
Ruby
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
lib
spec Add StringArray type. Sep 19, 2012
tasks initial commit May 22, 2012
.gitignore cleaning up and .gitignore May 22, 2012
.rvmrc initial commit May 22, 2012
Gemfile Designate rspec and jeweler as development dependencies so other vers… Sep 19, 2012
Gemfile.lock
LICENSE initial commit May 22, 2012
README.md
Rakefile bumped version to 0.8.2 Sep 19, 2012
VERSION
dm-pg-types.gemspec

README.md

dm-pg-types

Installation

dm-pg-types is available as a RubyGem. Simply put this in your Gemfile

gem 'dm-pg-types'

and you should be good to go.

DataMapper plugin providing support for PostgreSQL's HSTORE and ARRAY types. An example will suffice

DataMapper.setup(:default, 'postgres://localhost/dm_pg_types_person')
DataMapper.repository(:default).adapter.execute("DROP TABLE IF EXISTS people")
DataMapper.repository(:default).adapter.execute("CREATE EXTENSION HSTORE")

class Person
  include DataMapper::Resource

  property :id,        Serial
  property :name,      String
  property :info,      HStore
  property :decimals,  DecimalArray, :scale => 5, :precision => 10
end

DataMapper.finalize
DataMapper.auto_migrate!

p = Person.new
p.info = {:a => "b", :c => "d"}
p.decimals = [10.1, 11.2]
p.save

Thanks to https://github.com/softa/activerecord-postgres-hstore for doing most of the heavy lifting