activerecord-postgres-array 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,10 +23,12 @@ end
23
23
 
24
24
  * When queried, the postgres arrays will be returned as ruby arrays, and vice versa.
25
25
 
26
+ h3. Compatibility with activerecord-postgres-hstore
27
+
28
+ 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.
26
29
 
27
30
  h2. Current limitations
28
31
 
29
- * Validation of serialised postgres array strings is currently not implemented.
30
32
  * Parsing of multi-dimensional postgres array strings is currently not implemented.
31
33
  * 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
32
34
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "activerecord-postgres-array"
3
- s.version = "0.0.3"
3
+ s.version = "0.0.4"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Tim Connor"]
@@ -16,6 +16,8 @@ module ActiveRecord
16
16
  value = read_attribute(name)
17
17
  if column.type.to_s =~ /_array$/ && value && value.is_a?(Array)
18
18
  value = value.to_postgres_array(new_record?)
19
+ elsif defined?(::Hstore) && column.type == :hstore && value && value.is_a?(Hash)
20
+ value = value.to_hstore
19
21
  elsif klass.serialized_attributes.include?(name)
20
22
  value = @attributes[name].serialized_value
21
23
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgres-array
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Connor