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

undefined method `contact_persons=' #143

Closed
forrest opened this issue Apr 23, 2014 · 4 comments
Closed

undefined method `contact_persons=' #143

forrest opened this issue Apr 23, 2014 · 4 comments

Comments

@forrest
Copy link

forrest commented Apr 23, 2014

When using batch_save, I periodically receive this error. I never write to contact_persons or contact_people so I'm not sure where this is coming from.

Error during sync: undefined method `contact_persons=' for #<Xeroizer::Record::Contact:0x00000107aebe80>
/Users/forrest/.rvm/gems/ruby-2.1.1/bundler/gems/xeroizer-d82d83011096/lib/xeroizer/record/base.rb:68:in `block in attributes='
/Users/forrest/.rvm/gems/ruby-2.1.1/bundler/gems/xeroizer-d82d83011096/lib/xeroizer/record/base.rb:67:in `each'
/Users/forrest/.rvm/gems/ruby-2.1.1/bundler/gems/xeroizer-d82d83011096/lib/xeroizer/record/base.rb:67:in `attributes='
/Users/forrest/.rvm/gems/ruby-2.1.1/bundler/gems/xeroizer-d82d83011096/lib/xeroizer/record/base_model.rb:160:in `block (3 levels) in batch_save'
/Users/forrest/.rvm/gems/ruby-2.1.1/bundler/gems/xeroizer-d82d83011096/lib/xeroizer/record/base_model.rb:158:in `each'
/Users/forrest/.rvm/gems/ruby-2.1.1/bundler/gems/xeroizer-d82d83011096/lib/xeroizer/record/base_model.rb:158:in `each_with_index'
/Users/forrest/.rvm/gems/ruby-2.1.1/bundler/gems/xeroizer-d82d83011096/lib/xeroizer/record/base_model.rb:158:in `block (2 levels) in batch_save'
/Users/forrest/.rvm/gems/ruby-2.1.1/bundler/gems/xeroizer-d82d83011096/lib/xeroizer/record/base_model.rb:155:in `each_slice'
/Users/forrest/.rvm/gems/ruby-2.1.1/bundler/gems/xeroizer-d82d83011096/lib/xeroizer/record/base_model.rb:155:in `block in batch_save'
/Users/forrest/.rvm/gems/ruby-2.1.1/bundler/gems/xeroizer-d82d83011096/lib/xeroizer/record/base_model.rb:154:in `each_pair'
/Users/forrest/.rvm/gems/ruby-2.1.1/bundler/gems/xeroizer-d82d83011096/lib/xeroizer/record/base_model.rb:154:in `batch_save'
...
@forrest
Copy link
Author

forrest commented Apr 23, 2014

oh and thanks for the great library :-)

@forrest
Copy link
Author

forrest commented Apr 23, 2014

I think I've tracked it down to xeroizer not handling errors related to contact_people. In this case, it was because of a bug in my code resulting in 6 contacts being attached to a contact.

@waynerobinson
Copy link
Owner

Xeroizer has been updated specifically to include support for multiple contacts yet. This might be where the error is coming from.

I'm happy to accept a pull-request for this feature.

@CloCkWeRX
Copy link
Collaborator

I'm confused by https://github.com/waynerobinson/xeroizer/blob/master/lib/xeroizer/models/contact.rb#L46 - the API itself refers to it as ContactPersons (
http://developer.xero.com/documentation/api/contacts/#contact-persons). Nothing else in the codebase refers to contact_people, unless there's some weird inflection stuff happening.

Should it be

has_many  :contact_persons, :model_name => "ContactPerson"

not

has_many  :contact_persons, :internal_name => :contact_people

@rjaus rjaus closed this as completed Oct 19, 2017
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

4 participants