For me Products::to_csv did not successfully get called. Instead, a comma separated list of objecs was rendered. e.g #<MyObject:0x007fb05ee9eb00>,#<MyObject:0x007fb05ee9e4e8> (which is the same output as when there is no def self.to_csv)
I was only able to use this design by changing format.csv { send_data @products.to_csv }
to format.csv { send_data Product.to_csv(@products) }
For me Products::to_csv did not successfully get called. Instead, a comma separated list of objecs was rendered. e.g
#<MyObject:0x007fb05ee9eb00>,#<MyObject:0x007fb05ee9e4e8>
(which is the same output as when there is nodef self.to_csv
)I was only able to use this design by changing
format.csv { send_data @products.to_csv }
to
format.csv { send_data Product.to_csv(@products) }
ruby-1.9.3-p125
Rails 3.2.8