couchrest_model/lib/couchrest/model/validations.rb
Sam Lown c280b3a29b 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.
2010-06-20 22:01:11 +02:00

33 lines
783 B
Ruby

# encoding: utf-8
require "couchrest/model/validations/casted_model"
module CouchRest
module Model
# Validations may be applied to both Model::Base and Model::CastedModel
module Validations
extend ActiveSupport::Concern
included do
include ActiveModel::Validations
end
module ClassMethods
# Validates the associated casted model. This method should not be
# used within your code as it is automatically included when a CastedModel
# is used inside the model.
#
def validates_casted_model(*args)
validates_with(CastedModelValidator, _merge_attributes(args))
end
# TODO: Here will lie validates_uniqueness_of
end
end
end
end