Closed trevorrjohn closed 6 years ago
Thanks, my own version of this has been applied to master already! I like some of your style changes, but return [] if @object.empty?
introduces a regression when applied to ActiveRecord::Relations. The only assumption I make about collections is that they implement each
.
Sounds good. Makes sense with ActiveRecord::Relations
, I didn't think about that.
Although, I am not seeing the new code on master yet.
Should be up! I tagged a new version and stuff, I just called it 0.5.0 since it's a behavior change.
If you pass in an array of objects, each object should get it's own serializer instance.
Benchmark shows that the performance is not a blocker:
https://github.com/trevorrjohn/simple_serializer/blob/tj/benchmark/benchmark.rb