Skip to content

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

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
    

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions