riak-ripple / ripple

A rich Ruby modeling layer for Riak, Basho's distributed database
Other
618 stars 152 forks source link

Do not replace accessors defined by superclass #296

Closed ntalbott closed 12 years ago

ntalbott commented 12 years ago

ActiveModel 3.2 was changed to only consider methods that it defines when figuring out whether to override an accessor method. So:

class Parent include Ripple::Document

def foo
  "awesome"
end

end

class Child < Parent property :foo end

Child.new.foo #=> nil

This commit fixes it by reverting to the old behavior of not writing an accessor it is already defined anywhere in the hierarchy. This does not affect accessors created by ActiveModel itself, as those are undef'd en masse before the method_defined? check is called.

ntalbott commented 12 years ago

This passes all unit tests for me, but I'm having issues running integration tests at the moment (argh!)

travisbot commented 12 years ago

This pull request fails (merged 4a48b094 into c68106a8).

seancribbs commented 12 years ago

@ntalbott Looks good to me :+1:.