Thanks. That is helpful. What if I added a column that was an integer and copied the float to that column after converting it to an integer. I do not think any of them are out range. I kept as float as I took an outside dataset and imported it into this Rails app.
On Saturday, April 26, 2014 10:38:40 PM UTC-7, tekram wrote: > > 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c141b951-0d11-44b7-bc9d-d7f1091e2637%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

