Midwest Dev Chat


  • The newest 15 messages in the super-cool #ruby channel.

  • 11/20 12:39:26 Porter: that's the user's problem, then they just gotta go to the last page and work their way forward slightly_smiling_face /s
  • 11/20 12:40:18 Porter: okay thanks! I'll keep the rocket and put in a comment so that the next person can grumble about ruby instead of my non-adherence to the styleguide
  • 11/20 12:40:53 Jake: I think you could do `authors.order(params["sort"]: :desc)`
  • 11/20 12:41:13 Jake: …right?
  • 11/20 12:41:18 Porter: I tried that and my editor did not appreciate it
  • 11/20 12:41:30 Porter: although it's possible that the code itself would still evaluate, I didn't try it!
  • 11/20 12:41:38 Jake: hm yeah fair enough!
  • 11/20 12:42:33 Porter: `Unexpected ':', expecting ')'`
  • 11/20 13:10:06 Stevie: if you wanted to just do that you would have to do something akin to `.order("#{params['sort']}": :desc)` which is… IMO even more of an eye sore than a hash rocket.
  • 11/20 13:11:02 Stevie: I am curious to see if there is a more elegant solution than that though
  • 11/20 13:13:39 Porter: @Stevie I agree with you about the looks
  • 11/20 16:29:26 Andera: I think the `=>` syntax is ideal here. I suspect that what your team wants to avoid is the combination of symbol keys with the rocket (i.e. write `{ a: 7 }` instead of `{ :a => 7 }`).
  • 11/20 16:31:14 Marty: @Porter side note, I would validate that sort param that it matches something in `Author.column_names` first
  • 11/20 16:34:21 Marty: I agree with @Andera here, the hashrocket exists for exactly this situation, and if your team still rejects that use-case then they are being dumb
  • 11/20 17:08:00 Joella: ( cough `=>` is "fat comma" <#C02RNRS8Y|perl> )
  • *Usernames have been changed to protect the innocent.
We're currently 997 members strong. Join us!
Request Invite

Check out all the cool channels!

Join the conversation!