You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm retrieving a user with sideloaded identities, adding (additional) identities, and saving the user. If the user already has some identities, it works fine. However, if they don't, and I try to add some, I get the following error:
/Users/mwp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/zendesk_api-1.14.0/lib/zendesk_api/actions.rb:32:in `save!': undefined method `connection' for nil:NilClass (NoMethodError)
from /Users/mwp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/zendesk_api-1.14.0/lib/zendesk_api/actions.rb:47:in `save'
from /Users/mwp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/zendesk_api-1.14.0/lib/zendesk_api/collection.rb:366:in `block in _save'
from /Users/mwp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/zendesk_api-1.14.0/lib/zendesk_api/collection.rb:364:in `map!'
from /Users/mwp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/zendesk_api-1.14.0/lib/zendesk_api/collection.rb:364:in `_save'
from /Users/mwp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/zendesk_api-1.14.0/lib/zendesk_api/collection.rb:143:in `save'
from /Users/mwp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/zendesk_api-1.14.0/lib/zendesk_api/actions.rb:74:in `block in save_associations'
from /Users/mwp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/zendesk_api-1.14.0/lib/zendesk_api/actions.rb:66:in `each'
from /Users/mwp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/zendesk_api-1.14.0/lib/zendesk_api/actions.rb:66:in `save_associations'
from /Users/mwp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/zendesk_api-1.14.0/lib/zendesk_api/actions.rb:30:in `save!'
I suspect I need to initialize the identities collection on the user if it doesn't already exist. Here's what I'm trying, but it's not working (no change in behavior, still get the NoMethodError). Any suggestions would be appreciated!
Okay, let's try this again. The problem is that if you side-load an associated collection, you can't add something to that collection and save it (or its parent record). If you don't side-load (or add anything), it works fine. For example:
I'm retrieving a user with sideloaded identities, adding (additional) identities, and saving the user. If the user already has some identities, it works fine. However, if they don't, and I try to add some, I get the following error:
I suspect I need to initialize the identities collection on the user if it doesn't already exist. Here's what I'm trying, but it's not working (no change in behavior, still get the NoMethodError). Any suggestions would be appreciated!
Thank you in advance.
The text was updated successfully, but these errors were encountered: