Ruby on Rails: Select vs Pluck


pluck for model values, select for model objects

Nice blog post about this can be found here on Gavin Miller's site. He's "an app dev focused on Ruby and Rails."

Summarized:
  • select returns model objects
  • pluck returns the values instead
  • pluck outperforms select as it bypasses object creation

Comments