Skip to content

Arkenstone does not validate record before saving an existing record? #68

@kindrowboat

Description

@kindrowboat

Problem

While Arkenstone checks for validity before saving a new object, it does not extend the same courtesy to existing objects being saved, and will happily try to save an invalid document.

How to reproduce?

Given a document (e.g. User) with a validation requirement (e.g. validates :email, presence: true)

  1. Retrieve an already saved record

    user = User.find some_valid_id
    
  2. Set one of the attributes to an invalid value

    user.email = ''
    
  3. For fun, make sure that it is indeed invalid

    user.valid?
    => false
    
  4. Now try to save it, and watch it go through (unless the API resource rejects it)

    user.save
    => true
    

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