Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed invalid usage of Module#undef_method
* In MRI Module#undef_method accepts 0 or more method names, and removes
  them all. In JRuby it accepts only 1 method name. The documentation
  shows that only 1 method name should be provided, so JRuby matches the
  docs, while MRI has a much looser contract.

  DM was using the MRI API, but this has been changed to match the
  documented behaviour, and should work in JRuby.

[#1229 state:resolved]
  • Loading branch information
dkubb committed Apr 7, 2010
1 parent e196109 commit 7552a8b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/dm-core/associations/one_to_one.rb
Expand Up @@ -3,12 +3,12 @@ module Associations
module OneToOne #:nodoc:
class Relationship < Associations::Relationship
%w[ public protected private ].map do |visibility|
superclass.send("#{visibility}_instance_methods", false).each do |method|
undef_method method unless method.to_s == 'initialize'
end
methods = superclass.send("#{visibility}_instance_methods", false) |
DataMapper::Subject.send("#{visibility}_instance_methods", false)

# remove mixed in methods
undef_method *DataMapper::Subject.send("#{visibility}_instance_methods", false)
methods.each do |method|
undef_method method.to_sym unless method.to_s == 'initialize'
end
end

# Loads (if necessary) and returns association target
Expand Down

0 comments on commit 7552a8b

Please sign in to comment.