Closed soynog closed 1 year ago
Hi @soynog, what version of Rails are you using?
Edit. Just saw your comment at the end. I haven't checked if this gem works with Rails 5 yet, which it obviously doesn't. If I get some time, I'll investigate a Rails 5 compatibility fix.
Sounds good--probably that's the issue. Thanks!
I have the same issue in Rails 5.0.2 but without using active model serialization.
@kaleb4eg @soynog this gem adds to_csv
on two classes: Array and ActiveModel::Serialization. In previous versions of Rails, this was the pattern that was used for the other serializers. You can still get the benefit of the gem by either casting your collection to an Array, or using AsCSV::CSVBuilder
manually.
Closing this issue as out of date. Latest versions should work fine.
Not sure what I'm doing wrong... I've installed the gem. ActiveModel::Serialization is included by models. Individual model
to_csv
method works fine. Butto_csv
on a relation doesn't work:From the readme it sounds like I should be able to just install the gem, include Serialization on my model, and call to_csv on a relationship. Am I missing something?
Thanks!
FYI I'm using Ruby 2.4.0, Rails 5.0.2