Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.find not accepting string containing UUID #83

Open
caldwecr opened this issue Aug 2, 2016 · 1 comment
Open

.find not accepting string containing UUID #83

caldwecr opened this issue Aug 2, 2016 · 1 comment

Comments

@caldwecr
Copy link

caldwecr commented Aug 2, 2016

@pyromaniac - trying to following the example in the documentation that indicates

let(:guid) { "1dd74dd0-d116-11e0-99c7-5ac5d975667e" }
it "should be able to find an email by the uuid" do
  Email.find(guid).id.to_s.should == guid
end

This doesn't appear to work. When I try this myself I get ...

All examples were filtered out; ignoring {:focus=>true}

Models::Cognito::User

[6, 15] in /home/vagrant/dwapi/spec/models/cognito/user_spec.rb
    6:     user.id = "b465e6ed-34c5-4535-b26e-07de241b0d30"
    7: 
    8:     user.save!
    9: 
   10:     byebug
=> 11:     found_user = described_class.find "b465e6ed-34c5-4535-b26e-07de241b0d30"
   12: 
   13:     expect(found_user).to eq user
   14:   end
   15: end
(byebug) user
#<Models::Cognito::User id: #<UUID:0x53a6588 UUID:b465e6ed-34c5-4535-b26e-07de241b0d30>, account_id: nil, created_at: "2016-08-02 16:54:36", updated_at: "2016-08-02 16:54:36">
(byebug) user.id
#<UUID:0x53a6588 UUID:b465e6ed-34c5-4535-b26e-07de241b0d30>
(byebug) user.id.to_s
"b465e6ed-34c5-4535-b26e-07de241b0d30"
(byebug) Models::Cognito::User.find "b465e6ed-34c5-4535-b26e-07de241b0d30"
ActiveRecord::RecordNotFound Exception: Couldn't find Models::Cognito::User with 'id'=b465e6ed-34c5-4535-b26e-07de241b0d30
nil
(byebug) Models::Cognito::User.all
#<ActiveRecord::Relation [#<Models::Cognito::User id: #<UUID:0x55e8580 UUID:b465e6ed-34c5-4535-b26e-07de241b0d30>, account_id: nil, created_at: "2016-08-02 16:54:36", updated_at: "2016-08-02 16:54:36">]>

Advice?

@vigneshprakasam33
Copy link

vigneshprakasam33 commented Sep 27, 2016

I encountered the find bug in my application as well. For development log, the SQL statement for
Ivr.find_by_uuid("d9d98467-26e6-4437-87f7-61e6605bb6f5") is,

SELECT ivrs.* FROM ivrs WHERE ivrs.uuid = 'd9d98467-26e6-4437-87f7-61e6605bb6f5'

The where clause is not comparing in binary.

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

No branches or pull requests

2 participants