ActiveRecord - Retrieve only a column from DB
Use
.pluck(:column_name)
Example:
User.pluck(:email)
=> ["cliente1@fottorama.com.br", "cliente2@fottorama.com.br", "cliente3@fottorama.com.br"]
Written by Rafael Oliveira
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#