Skip to content
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

on foo_create, facebook returns an ID (string) that blows up map_data #142

Open
klochner opened this issue Sep 18, 2013 · 1 comment
Open

Comments

@klochner
Copy link
Contributor

example:

post = Mogli::Post.find(some_post_id)
post.comments_create({message: "hello"})

The call to client.post will return a string, which blows up with this stack trace (line numbers may be off):

 NoMethodError - undefined method `each' for  
                       "20151777981831111_57381111":String:
 (gem) mogli-0.0.42/lib/mogli/model.rb:22:in `Mogli::Comment#initialize'
 (gem) mogli-0.0.42/lib/mogli/client.rb:219:in `Mogli::Client#create_instance'
 (gem) mogli-0.0.42/lib/mogli/client.rb:219:in `Mogli::Client#map_to_class'
 (gem) mogli-0.0.42/lib/mogli/client.rb:210:in `Mogli::Client#map_data'
 (gem) mogli-0.0.42/lib/mogli/client.rb:169:in `Mogli::Client#post'

I'm hesitant to try hacking a fix, since there may be other non-hash/array values that need to be handled by other calls. This may be fixable by setting a default field as done here:

#127

@yitaosun - can you take a look? This looks similar to the fix you put in for location.

@mmangino
Copy link
Owner

how annoying. I think it's sane to create an instance with that as an id if we get a non hash. We could just turn a string into {id: string}

I don't think Facebook should be allowed to do API design :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants