I can't seem to seem to get this find condition to work properly.

I have an object stored in @ip_range, with a float-longitude:

>> @ip_range.lng
=> 11.967

I then want to match this longitude to a City:

>> @city = City.find(:first, :conditions => ["lng = ?", @ip_range.lng])
=> nil

But I know that it should work, since there is a match in the table,
with an id of 4:

@city_debug = City.find(4)
=> #<City id: 4, name: "goteborg", lng: 11.967, lat: 57.717, created_at:
"2008-09-29 23:30:34", updated_at: "2008-09-30 16:46:02">

>> @city_debug.lng
=> 11.967

>> @city_debug.lng == @ip_range.lng
=> true

Something is wrong in my find-condition, but I can't seem to figure out
what it is... maybe something to with floats in find conditions?

Thanks!

g.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to