pluck and select
pluck
return Array object as the resultselect
return ActiveRecord::Relation object as the resultselect
always returnsid: nil
property in your ActiveRecord results if you don't select:id
. For converting your object to json without id:nil, you could do as following:record(s).to_json(only:[:column1, :column2, ...:column3])
photos = Photo.select(:name, :path_original, :path_small) respond_with photos.to_json(only: [:name, :path_original, :path_small])