Skip to content
This repository has been archived by the owner on Sep 2, 2019. It is now read-only.

Composed natural keys #31

Closed
sfeu opened this issue Mar 20, 2012 · 1 comment
Closed

Composed natural keys #31

sfeu opened this issue Mar 20, 2012 · 1 comment

Comments

@sfeu
Copy link

sfeu commented Mar 20, 2012

Hi,

there is still a problem with natural keys. If there is more than one key
defined, the common query does not work anymore.

    it "should find elements with two natural keys" do
      class Foo
        include DataMapper::Resource
        property :key1,   String, :key => true
        property :key2, String, :key => true
      end
      DataMapper.finalize

      Foo.create(:key1 => "value1", :key2 => 'value2')
      Foo.first(:key1 => "value1").key2.should == 'value2'
    end

+1332267068.573186 (db 15) "select" "15"
+1332267068.573313 (db 15) "incr" "foos:key1:key2:serial"
+1332267068.573524 (db 15) "sadd" "foos:key1:key2:all" "value1value2"
+1332267068.573687 (db 15) "hmset" "foos:value1value2" "key1" "value1" "key2" "value2"
+1332267068.574434 (db 15) "sismember" "foos:key1:key2:all" "value1"
+1332267068.575936 (db 15) "select" "15"
+1332267068.576032 (db 15) "flushdb"

@sfeu
Copy link
Author

sfeu commented Mar 20, 2012

composite key look-up fails as well

Foo.get("value1","value2").key2.should == 'value2'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants