I have set my float id's. I have a Rails 3.0 app and using a MySQL 
database. It seemed to work fine on a Postgres database. 

Here is my problem:

irb(main):033:0> Patient.first

  *Patient Load (1.3ms)*  SELECT `patients`.* FROM `patients` LIMIT 1

=> #<Patient pid: 29312000.0, created_at: "2014-04-25 19:05:10", 
updated_at: "2014-04-25 19:05:10", race: "WHITE", ethnicity: "NOT 
HISPANIC", age: 47>

irb(main):034:0> Patient.find_by_pid(Patient.first.pid)

  *Patient Load (1.1ms)*  *SELECT `patients`.* FROM `patients` LIMIT 1*

  *Patient Load (346.1ms)*  SELECT `patients`.* FROM `patients` WHERE 
`patients`.`pid` = 29312000.0 LIMIT 1

=> nil

Basically, I can not use where I have used Float as a part of an Active 
Record Query. Another similar problem on another model. 

irb(main):035:0> Lab.first

  *Lab Load (1.3ms)*  *SELECT `labs`.* FROM `labs` LIMIT 1*

=> #<Lab id: 1, patient_id: 29312000.0, code_id: 1, lab_date: "2010-11-29", 
value: 51, age: 47, created_at: "2014-04-25 19:05:10", updated_at: 
"2014-04-25 19:05:10", difference: 12, report_id: 2432930000.0>

irb(main):036:0> Lab.find_by_patient_id(Lab.first.patient_id)

  *Lab Load (1.2ms)*  SELECT `labs`.* FROM `labs` LIMIT 1

  *Lab Load (341.4ms)*  *SELECT `labs`.* FROM `labs` WHERE 
`labs`.`patient_id` = 29312000.0 LIMIT 1*

 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c3009ec3-2990-44ab-960e-caa75658b3b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to