Reputation: 254
I have a table in a Rails application where each column is of type String. This column, which will shall call mycolumn, is formatted such that each entry fits the format NN:NN where N is some digit from 0 - 9.
Now where I'm having trouble is I need to find all the elements such that mycolumn[0..1] is with in a certain range (lets just say 35).
I'm thinking the statement would look something like
Mytable.find(:all, :conditions => ['? <= 35', :mycolumn[0..1].to_i])
Would this work? Is there another way to do this?
Upvotes: 0
Views: 73
Reputation: 40277
No, that won't work that way --- you are going to have to either:
I recommend #2 --- store the core data, and then add a method to format it to NN:NN
Upvotes: 1