map vs pluck


Both methods return the same output (an array of strings).{|a| a.title}

But they do that in different ways.

SQL query generated by all:

SELECT "articles".* FROM "articles"

It fetches all atributes, then it converts the collection with map method.

SQL query generated by pluck (or .all.pluck):

SELECT "articles"."title" FROM "articles"

pluck is faster.