Skip to content

Question regarding model with unsaved parent #233

@marcus-allabrf

Description

@marcus-allabrf

Here, invoice1 is the parent of invoice2:

invoice1 = Fortnox::API::Model::Invoice.new(customer_number: '1')
invoice2 = invoice1.update(due_date: '2023-01-01')

We have:

puts invoice2.customer_number # 1
puts invoice2.due_date # 2023-01-01

However, when saving invoice2:

Fortnox::API::Repository::Invoice.new.save(invoice2)

the following data is posted via POST /3/invoices/:

{"Invoice": {"DueDate": "2023-01-01"}}

but shouldn't the following data be posted or am I missing something?:

{"Invoice"=>{"CustomerNumber"=>"1", "DueDate"=>"2023-01-01"}}

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