Skip to content

Instantly share code, notes, and snippets.

@djwonk
Created October 11, 2008 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djwonk/16199 to your computer and use it in GitHub Desktop.
Save djwonk/16199 to your computer and use it in GitHub Desktop.
Perhaps model.rb line 195 has a bug.
The addition operator is probably intended to remove duplicates
(set like behavior) but does not appear to actually do so.
merb -i
repos = User.repositories
rarr = []
repos.each { |r| rarr << r }
rarr[0].inspect
=> "#<DataMapper::Repository:0x1a95f8c @identity_maps={}, @name=:default>"
rarr[1].inspect
=> "#<DataMapper::Repository:0x1a960a4 @identity_maps={}, @name=:default>"
rarr[0] == rarr[1]
=> true
rarr[0].eql? rarr[1]
=> true
rarr[0].equal? rarr[1]
=> false
rarr[0].hash
=> 13938630
rarr[1].hash
=> 13938770
def repositories
[ repository ].to_set + @properties.keys.collect { |repository_name| DataMapper.repository(repository_name) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment