R
Rob Redmon
I have an ActiveRecord find result. An element's contents look like:
irb(main):090:0> results[0]
=> #<InventoryHour id: 47475, observation_time: "2008-01-01 00:00:00",
station_id: 6, extension_id: 22, disk: 4, archive: 0, updated_on:
"2009-04-15 15:57:16">
The class of "observation_time" is:
results[0].observation_time.class
=> Time
What I'd like to do is find those elements which match on a particular
range of "observation_time". I'm used to Matlab and IDL programming
where one just does something like this:
indices = where( results.observation_time >= "2008-1-1" and
results.observation_time < "2009-1-1" )
What's the ruby way? Obviously, I can't use Array.include? but
something like that would be nice.
Rob
irb(main):090:0> results[0]
=> #<InventoryHour id: 47475, observation_time: "2008-01-01 00:00:00",
station_id: 6, extension_id: 22, disk: 4, archive: 0, updated_on:
"2009-04-15 15:57:16">
The class of "observation_time" is:
results[0].observation_time.class
=> Time
What I'd like to do is find those elements which match on a particular
range of "observation_time". I'm used to Matlab and IDL programming
where one just does something like this:
indices = where( results.observation_time >= "2008-1-1" and
results.observation_time < "2009-1-1" )
What's the ruby way? Obviously, I can't use Array.include? but
something like that would be nice.
Rob