datamapper / dm-types

DataMapper plugin providing extra data types
http://datamapper.org/
MIT License
55 stars 80 forks source link

DirtyMinder should not extend NilClass #71

Closed blt04 closed 9 years ago

blt04 commented 10 years ago

Can PR #50 be back ported to the release-1.2 branch? When using DataMapper with Passenger, Passenger sometimes freezes the nil value (see https://code.google.com/p/phusion-passenger/issues/detail?id=1093). When DirtyMinder tries to track a frozen nil value, an error can occur:

/Users/bturner/.rvm/gems/ruby-2.1.2@ghnproxy/gems/dm-types-1.2.2/lib/dm-types/support/dirty_minder.rb:144:in `track': can't modify frozen object (RuntimeError)
    from /Users/bturner/.rvm/gems/ruby-2.1.2@ghnproxy/gems/dm-types-1.2.2/lib/dm-types/support/dirty_minder.rb:161:in `hook_value'
    from /Users/bturner/.rvm/gems/ruby-2.1.2@ghnproxy/gems/dm-types-1.2.2/lib/dm-types/support/dirty_minder.rb:151:in `set!'
    from /Users/bturner/.rvm/gems/ruby-2.1.2@ghnproxy/gems/dm-core-1.2.1/lib/dm-core/property.rb:625:in `set'
    from /Users/bturner/.rvm/gems/ruby-2.1.2@ghnproxy/gems/dm-core-1.2.1/lib/dm-core/resource/persistence_state.rb:22:in `set'
    from /Users/bturner/.rvm/gems/ruby-2.1.2@ghnproxy/gems/dm-core-1.2.1/lib/dm-core/resource/persistence_state/transient.rb:14:in `set'
    from /Users/bturner/.rvm/gems/ruby-2.1.2@ghnproxy/gems/dm-core-1.2.1/lib/dm-core/model/property.rb:238:in `headers='
    from test.rb:19:in `<main>'

PR #50 limited extending classes with Hooker to only certain classes. It would be awesome to back port this fix into 1.2.x.

This PR simply cherry-picks mbj's fixes to release-1.2.

tpitale commented 9 years ago

I've run the specs locally on branch release-1.2. I think this is safe to merge, ignoring Travis-CI failure.

tpitale commented 9 years ago

I've merged this in my own fork into release-1.2 and deployed my app. That's working fine, but obviously does not test the range of rubies and datastores that Travis is.