Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Postgres array support for Active Record
Ruby
branch: master

This branch is 45 commits behind tlconnor:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
.gitignore
LICENSE
README.textile
activerecord-postgres-array.gemspec

README.textile

Postgres array support for activerecord

Add basic support for postgres arrays to activerecord, with special attention to getting rails migrations / schema dumps working nicely.

Installation

gem install activerecord-postgres-array

or if you use bundler

gem 'activerecord-postgres-array'

Usage

  • In your migrations you can define postgres array fields such as:
    create_table :people do |t|
      ...
      t.string_array :real_energy
      t.decimal_array :real_energy, :precision => 18, :scale => 6
      ...
    end
    
  • When queried, the postgres arrays will be returned as ruby arrays, and vice versa.

Current limitations

  • Validation of serialised postgres array strings is currently not implemented.
  • Parsing of multi-dimensional postgres array strings is currently not implemented.
  • String and Decimal arrays have been tested, but other array types have not been. Type casting will need to be implemented for booleans, dates, etc

Future enhancements

  • Arel like querying of values within arrays
  • Arel like aggregate functions
Something went wrong with that request. Please try again.