comma-csv/comma

filename option not working for me

kblake opened this issue · 1 comments

Everything works for me using default csv options...
respond_to do |format|
format.csv { render :csv => Order.created_today }
end

However when I add the filename option I get this error:

No comma format for class ActiveRecord::NamedScope::Scope defined for style filenameGenetree_Orders.csv

respond_to do |format|
format.csv { render :csv => Order.created_today.to_comma(:filename => 'Genetree_Orders.csv') }
end

I've looked at the specs and it appears I am calling the code correctly. Any suggestions?

I know this is 1y old.. but if someone encounters this problem again, the correct way to give the filename for you case is:

format.csv { render :csv => Order.created_today, :filename => 'Genetree_Orders.csv' }

Would be really helpful to have this documented

Thanks for the gem