voiplogs = where(['data > ? AND data < ?', start_date,
end_date]).group_by(&:cli)
it's works, but how add also sort by :cli
Tanks to all
Fabio
--
Posted via http://www.ruby-forum.com/.
I tried this code:
voiplogs = where(['data > ? AND data < ?', start_date,
end_date]).group_by(&:cli)
it's works, but how add also sort by :cli
Tanks to all
Fabio
--
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 rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
...group_by(&:cli).sort
Otherwise, you can't because hashes are unordered by nature. You can
sort the keys and then access the hash using the sorted keys. Or, you
can use ActiveSupport::OrderedHash, and try to figure out how to
initialize it when you have a Hash.