RailsCasts Pro episodes are now free!

Learn more or hide this

sergeyki's Profile

GitHub User: sergeyki

Comments by

Avatar

I think you define products as following:

@products = Product.all
@products.class #---> Array

but when you fetch data by calling order():

@products = Product.order(:name)
@products.class #---> ActiveRecord::Relation
in this case you do not have to call Product twice, like Product.to_csv.