# activerecord-postgres-array **Repository Path**: mirrors_crealytics/activerecord-postgres-array ## Basic Information - **Project Name**: activerecord-postgres-array - **Description**: No description available - **Primary Language**: Unknown - **License**: ISC - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-10-22 - **Last Updated**: 2026-05-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README h2. Postgres array support for activerecord Add basic support for postgres arrays to activerecord, with special attention to getting rails migrations / schema dumps working nicely. h2. Installation
gem install activerecord-postgres-array
or if you use bundler
gem 'activerecord-postgres-array'
h2. 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.
h3. Compatibility with activerecord-postgres-hstore
activerecord-postgres-hstore and activerecord-postgres-array both monkeypatch @ActiveRecord::Base#arel_attributes_values@, which leads to problems if these gems are used together. This gem is aware of activerecord-postgres-hstore and incorporates it in the monkeypatch. However, it is important that activerecord-postgres-array is loaded _after_ activerecord-postgres-hstore for this to work.
h2. Current limitations
* 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
h3. Future enhancements
* Arel like querying of values within arrays
* Arel like aggregate functions