Browse files

Remove monkey patch of activerecord

According to Tonkpils/activerecord-postgres-hstore@7284b8b and version '0.7.0' of the activerecord-postgres-hstore gem, their monkey patch of active record has been removed and support for . This causes the monkeypatch this gem does for compatibility to break.
  • Loading branch information...
1 parent ef99da0 commit b2e1f19568c5baeabd49fa20deb1ebd9a8005d5a @Tonkpils Tonkpils committed Feb 15, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −0 README.textile
  2. +0 −2 lib/activerecord-postgres-array/activerecord.rb
@@ -25,6 +25,12 @@ end
h3. Compatibility with activerecord-postgres-hstore
+As of activerecord-postgres-hstore '0.7.0', @ActiveRecord::Base#arel_attributes_value@ is not monkey patched and therefore does not interfere with loading of this gem.
+If you are using '0.6.0', or earlier, of activerecord-postgres-hstore you must use this gem's version '0.0.8' and the following still applies:
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
@@ -16,8 +16,6 @@ def arel_attributes_values(include_primary_key = true, include_readonly_attribut
value = read_attribute(name)
if column.type.to_s =~ /_array$/ && value && value.is_a?(Array)
value = value.to_postgres_array(new_record?)
- elsif defined?(::Hstore) && column.type == :hstore && value && value.is_a?(Hash)
- value = value.to_hstore
elsif klass.serialized_attributes.include?(name)
value = @attributes[name].serialized_value

0 comments on commit b2e1f19

Please sign in to comment.