RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: sergeyki
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.
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.