Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Andy Weber's Profile

GitHub User: ahabman

Site: http://ahabman.com

Comments by Andy Weber

Avatar

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) }

ruby-1.9.3-p125
Rails 3.2.8