alexrothenberg / motion-addressbook

MIT License
89 stars 30 forks source link

person objects saved partially. #67

Open khaledrepos opened 10 years ago

khaledrepos commented 10 years ago

I am trying to save a person object as follows:

    x= ab.new_person(:first_name => 'Alex', :last_name => 'Rothenberg', :emails => [{ :value => 'alex@example.com', :label => 'Home'}], :phones => [{ :value => '9920149993', :label => 'Mobile'}])

puts x # => #<AddressBook::Person:-1: {:first_name=>"Alex", :last_name=>"Rothenberg", :emails=>[{:value=>"alex@example.com", :label=>"Home"}], :phones=>[{:value=>"9920149993", :label=>"Mobile"}]}>

x.save

puts x # => #<AddressBook::Person:18: {:phones=>[{:value=>"9920149993", :label=>"Mobile"}], :emails=>[{:value=>"alex@example.com", :label=>"Home"}]}>

As you can see, the object is not saved entirely. Am I missing something? Thanks.

jmay commented 10 years ago

I cut & pasted your example and it worked just fine for me:

(main)> x.save
=> #<AddressBook::Person:2: {:first_name=>"Alex", :last_name=>"Rothenberg", :phones=>[{:value=>"9920149993", :label=>"Mobile"}], :emails=>[{:value=>"alex@example.com", :label=>"Home"}]}>

That's in the simulator. Are you on iOS or OSX? What version of RubyMotion? What version of motion-addressbook?

khaledrepos commented 10 years ago

Sorry for not providing those details. I tried this both on the simulator and the device. I am on ios. Here are the details: Rubymotion version: 2.31
iPhoneSimulator version: 7.1

For some reason, it's working correctly now. But I had some unexpected behaviour such as dropping the first and last name or storing them in the notes field instead of their respective places.

Thank you!

jmay commented 10 years ago

I'll leave this item open for a while in case the issue appears again. I don't have any current theories about cause.

On Fri, Aug 29, 2014 at 10:52 PM, khaledalissa notifications@github.com wrote:

Sorry for not providing those details. I tried this both on the simulator and the device. I am on ios. Here are the details: Rubymotion version: 2.31

iPhoneSimulator version: 7.1

For some reason, it's working correctly now. But I had some unexpected behaviour such as dropping the first and last name or storing them in the notes field instead of their respective places.

— Reply to this email directly or view it on GitHub https://github.com/alexrothenberg/motion-addressbook/issues/67#issuecomment-53949836 .