No commit activity in last 3 years
No release in over 3 years
Adds missing native PostgreSQL array types to ActiveRecord
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3.0
~> 0.13.2
~> 3.2.0
~> 2.12.0

Runtime

 Project Readme

ActiveRecordPostgisArrays

Adds support for missing PostgreSQL data types to ActiveRecord.

Build Status Code Climate

Looking for help?

If it is a bug please open an issue on Github. If you need help using the gem please ask the question on Stack Overflow. Be sure to tag the question with DockYard so we can find it.

Installation

Add this line to your application's Gemfile:

gem 'activerecord-postgis-array'

And then execute:

$ bundle

Or install it yourself as:

$ gem install activerecord-postgis-array

Usage

Just require 'activerecord-postgis-array' and use ActiveRecord as you normally would! postgres_ext extends ActiveRecord's data type handling.

Usage Notes

Avoid the use of in place operators (ie Array#<<). These changes are not tracked by Rails (this issue) explains why). In place modifications also modify the default object.

Assuming we have the following model:

create_table :items do |t|
  t.string :names, :array => true, :default => []
end

class Item < ActiveRecord::Base
end

The following will modify the default value of the names attribute.

a = Item.new
a.names << 'foo'

b = Item.new
puts b.names
# => ['foo']

The supported way of modifying a.names:

a = Item.new
a.names += ['foo']

b = Item.new
puts b.names
# => []

As a result, in place operators are discouraged and will not be supported in postgres_ext at this time.

Authors

Dan McClain twitter github