Skip to content

Exception trying to save existing contact without contact_lists #10

@boone

Description

@boone

The gem raises an exception when you try to save an existing contact which has no contact lists (e.g. one that is in the do-not-mail group).

> contact = ConstantContact::Contact.find(1)
 => #<ConstantContact::Contact:0x100000000 @prefix_options={}, @attributes={"Status"=>"Do Not Mail", ...

> contact.contact_lists
 => nil

> contact.save
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.sort
    from .../lib/constant_contact/contact.rb:21:in `to_xml'
...

I'm new to Constant Contact, so perhaps you aren't allowed to update contacts that are in the do-not-mail group, but in that case there should be a more meaningful error. If you are allowed to update these contacts, there should be a way to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions