#1394 ✓resolved
Yi Wen

dm-serializer to_json is broken when loading has n association

Reported by Yi Wen | August 27th, 2010 @ 11:35 AM | in 1.1

When using dm-serializer 6228495, and using to_json on a has_many association, the lib/dm-serializer/commons.rb, line #24 is broken because options is nil. I tried to add options ||= {} before the line, now at lib/dm-serializer/to_json.rb, line#27 is broken: Array(options[:methods]). So I added ptions ||= {} in the as_json method, which fixed the issue.

An example call is like this:
person.to_json(:methods => [:emails])

THanks

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Referenced by

Pages