-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parse_root_in_json regression introduced in 0.10.2 #508
Comments
See the problem. I'll take a look shortly. Thanks @espen 👍 |
Here's a failing spec I think captures the problem. Working on a fix... context "to a symbol" do
before do
Her::API.default_api.connection.adapter :test do |stub|
stub.post("/users") { [200, {}, { person: { id: 1, fullname: "Lindsay Fünke" } }.to_json] }
end
spawn_model("Foo::User") { parse_root_in_json :person }
end
it "parse the data with the symbol" do
@new_user = Foo::User.create(fullname: "Lindsay Fünke")
expect(@new_user.id).to eq(1) #=> failing
expect(@new_user.fullname).to eq("Lindsay Fünke")
end
end |
Thanks @zacharywelch ! 😇 |
Can confirm this works. Thanks for the quick fix @zacharywelch 🎉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a JSON which returns a person object but my class is called member so I use parse_root_in_json :person. This has worked up to 0.10.1 but with 0.10.2 the returned object is a Member object with a person object instead of just having the person attributes on the Member object.
So instead of member.name as before, with 0.10.2 I have to do member.person.name.
Looks like df1b82b is the only commit in v.010.2
I'll try to put up a failing test for this.
The text was updated successfully, but these errors were encountered: