Skip to content

Commit

Permalink
Remove monkey patch of activerecord
Browse files Browse the repository at this point in the history
According to https://github.com/Tonkpils/activerecord-postgres-hstore/commit/7284b8b063293428292666c7290592ea922ca598 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
Tonkpils committed Feb 15, 2013
1 parent ef99da0 commit b2e1f19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ end

h3. Compatibility with activerecord-postgres-hstore

**Note**

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
Expand Down
2 changes: 0 additions & 2 deletions lib/activerecord-postgres-array/activerecord.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
end
Expand Down

0 comments on commit b2e1f19

Please sign in to comment.