Page 2 of 760 results found for <=> ruby
=> 'name') ... or this way: @tickets = Ticket.find(:all).sort!{|t1,t2|t1.name <=> t2.name} (Tip: Ruby documentation explains that sort! will modify the
http://stackoverflow.com/question...o-you-normally-sort-items-in-rails
in the Controller? Any help is highly appreciated! Tags: ruby-on-rails ruby The simplest way is to override <=> in Project: def <=>(other_project)
http://stackoverflow.com/questions/3272192/sort-array-in-controller
Difference between <=> and == in Ruby? Difference between <=> and == in Ruby? What are their differences? Coming from a Java background, it does seem
http://stackoverflow.com/question...465/difference-between-and-in-ruby
Thanks in advance Francesco Tags: ruby-on-rails activerecord Are you on Rails2 or Rails3? On Rails3, you can use the Ruby sort method and something like:
http://stackoverflow.com/question...-order-a-table-by-associated-model
b.attribute } BUT, you need to make sure that the <=> operator is implemented for that attribute. If it's a Ruby native data type, this isn't a problem.
http://stackoverflow.com/question...bjects-in-ruby-by-object-attribute
Thanks, Joe Tags: ruby-on-rails ruby refactoring metaprogramming Even in plain Ruby you could still do the simpler: def expired? Time.now > self.updated_at
http://stackoverflow.com/question...3/more-ruby-esque-way-to-code-this
in ruby, how sort an array of hashes? in ruby, how sort an array of hashes? In my rails 3 app, I'm getting data from an external web resources that
http://stackoverflow.com/question...n-ruby-how-sort-an-array-of-hashes
rubyish that makes this really easy. Tags: ruby arrays I know the question has been answered, and I'm not going to address it now, but.. Are you sure an
http://stackoverflow.com/question...sorting-an-array-of-arrays-in-ruby
sort_me.sort! { |x, y| x["value"] <=> y["value"] } Ruby's sort doesn't sort in-place. (Do you have a Python background, perhaps?) Ruby has sort! for in-place
http://stackoverflow.com/question...y-of-hashes-by-a-value-in-the-hash
What is going on in ruby's sort method? What is going on in ruby's sort method? Possible Duplicate: Ruby spaceship operator <=> What do 'a' and 'b'
http://stackoverflow.com/question...t-is-going-on-in-rubys-sort-method