M
Mike Dershowitz
Ok, this one is a little complicated and I'm sure there's a better way
to do it. Here's what I'm doing:
For presentation purposes, I have an array of arrays. Here's the
structure of the array:
[
"indicator (string that I set" ,
<model object from db, different models> ,
timestamp
]
I'm creating and inserting the timestamp myself, as each model object
has a form of timestamp, whether or not it's called that.
I'm doing it this way becuase I use a model method to get all of this
data, and the thing I want to do last is to sort by "timestamp".
array.sort_by won't work becuase it's not a hash (although i tried
adding a hash and then sorting by that hash, but that didn't work either
(got a nomethod error).
How can I make it so that I can sort this array?
Thanks so much in advance!
Mike
to do it. Here's what I'm doing:
For presentation purposes, I have an array of arrays. Here's the
structure of the array:
[
"indicator (string that I set" ,
<model object from db, different models> ,
timestamp
]
I'm creating and inserting the timestamp myself, as each model object
has a form of timestamp, whether or not it's called that.
I'm doing it this way becuase I use a model method to get all of this
data, and the thing I want to do last is to sort by "timestamp".
array.sort_by won't work becuase it's not a hash (although i tried
adding a hash and then sorting by that hash, but that didn't work either
(got a nomethod error).
How can I make it so that I can sort this array?
Thanks so much in advance!
Mike