Renaming to CouchRest Model
Refactored basic directory structure. Moved to ActiveSupport for Validations and Callbacks. Cleaned up older code, and removed support for text property types.
This commit is contained in:
parent
9f1eea8d32
commit
c280b3a29b
70 changed files with 1725 additions and 3733 deletions
23
lib/couchrest/model/errors.rb
Normal file
23
lib/couchrest/model/errors.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
# encoding: utf-8
|
||||
module CouchRest
|
||||
module Model
|
||||
module Errors
|
||||
|
||||
class CouchRestModelError < StandardError; end
|
||||
|
||||
# Raised when a persisence method ending in ! fails validation. The message
|
||||
# will contain the full error messages from the +Document+ in question.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# <tt>Validations.new(person.errors)</tt>
|
||||
class Validations < CouchRestModelError
|
||||
attr_reader :document
|
||||
def initialize(document)
|
||||
@document = document
|
||||
super("Validation Failed: #{@document.errors.full_messages.join(", ")}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue