Sha256: 3fbe0b2fa741932f815ad143bd999d4333fc1f092b3a5b6cc266cfb14464bda3
Contents?: true
Size: 812 Bytes
Versions: 9
Compression:
Stored size: 812 Bytes
Contents
module MongoModel module Validations extend ActiveSupport::Concern include ActiveModel::Validations module ClassMethods def property(name, *args, &block) #:nodoc: property = super if property.validate? validates_associated(name) if property.embeddable? validates_presence_of(name) if property.options[:required] validates_format_of(name, property.options[:format]) if property.options[:format] end property end end def valid?(context=nil) context ||= new_record? ? :create : :update super end end end Dir[File.dirname(__FILE__) + "/validations/*.rb"].sort.each do |path| filename = File.basename(path) require "mongomodel/concerns/validations/#{filename}" end
Version data entries
9 entries across 9 versions & 1 rubygems