Skip to content

Add support to force save entity as new #224

@ehannes

Description

@ehannes

I have found a new use case for the gem - copy data from one Fortnox instance to another. The current implementation tries to save us an API call by checking the dirty tracking of the model and see if it's already saved before trying to save it. But if you want to fetch a resource from one Fortnox instance and save it to another, the model is marked as saved and it will not be saved.

One proposal is to add a force override:

def save(entity, force: false)
  return save_new(entity) if force

  return true if entity.saved?

  return save_new(entity) if entity.new?

  update_existing(entity)
end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions