
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
-
Dan Kubb (dkubb) September 17th, 2010 @ 10:25 PM
- State changed from new to unconfirmed
@Yi: I'm unable to reproduce the problem you describe locally. Would you mind supplying a stand-alone script I can execute so I can see the problem on my end too?
-
Dan Kubb (dkubb) September 17th, 2010 @ 11:04 PM
- State changed from unconfirmed to accepted
- Assigned user set to Dan Kubb (dkubb)
@Yi: I found another ticket for the same issue that allowed me to reproduce the problem. This ticket should be resolved shortly.
-
Dan Kubb (dkubb) September 17th, 2010 @ 11:04 PM
- Milestone set to 1.1
- Milestone order changed from 196265 to 0
-
Dan Kubb (dkubb) September 17th, 2010 @ 11:08 PM
- State changed from accepted to resolved
(from [64464a03b6d8485fbced0a5d7150be90b6dcaf2a]) Fixed problem when #as_json received nil instead of a Hash
[#1394 state:resolved] [#1406 state:resolved] http://github.com/datamapper/dm-serializer/commit/64464a03b6d8485fb...
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Referenced by
-
1406 Model#as_json method with explicit nil argument (ActiveSupport compatibility) [#1394 state:resolved] [#1406 state:resolved] http://git...
-
1394 dm-serializer to_json is broken when loading has n association [#1394 state:resolved] [#1406 state:resolved] http://git...