Skip to content

Validations are buggy #2

Description

@tapajos

Issue from: http://github.com/couchrest/couchrest/issues#issue/28

Code:


class Crap < CouchRest::ExtendedDocument
  include CouchRest::Validation
  use_database CouchDB.default_database

  property :fail

  before_save :check_something

  private
    def check_something
      self.errors.add(:fail, "You're bastard")
    end
end

Output from console:



> crap = Crap.new
> => {"couchrest-type"=>"Crap"}
> 
> > crap.fail = 'something'
> > => "something"
> > crap.valid?
> > => true
> > crap.save
> > => true
> > crap.errors
> > => #["You're bastard"]}>
> > crap.valid?
> > => 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