I installed the comma gem today and everything worked perfectly, but the actual .csv file is empty except for the first cell, which reads:
#<Proc:0x2795700@C:/Ruby192/lib/ruby/gems/1.9.1/gems/comma-0.4.1/lib/comma/rende开发者_开发问答r_as_csv.rb:35>
I'm calling comma with this in my controller:
def index
@registrants = @rsvp.rsvp_registrants
respond_to do |format|
format.html
format.csv { render :csv => @registrants }
end
end
And keeping it simple in my model for now:
comma do
email
end
I have tried various other queries, including ones that only return one record, just for troubleshooting purposes. Also installed fasterCSV just now in case it was a dependency.
I'm on Rails 3, Ruby 1.9.2, developing on a Windows XP machine.
Any help is appreciated. Thanks!
It seems like the latest version of comma(0.4.1) is missing this patch to fix Rails3 rendering support which seems like it would fix the problem you are experiencing.
Try using comma from github instead
gem "comma", :git => "git://github.com/crafterm/comma.git"
精彩评论