Module: Koujou::ActiveRecordExtensions::ValidationReflection
- Defined in:
- lib/koujou/validation_reflection.rb
Overview
:nodoc:
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
53 54 55 56 |
# File 'lib/koujou/validation_reflection.rb', line 53 def self.included(base) return if base.kind_of?(Koujou::ActiveRecordExtensions::ValidationReflection::ClassMethods) base.extend(ClassMethods) end |
.install(base) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/koujou/validation_reflection.rb', line 58 def self.install(base) reflected_validations.freeze reflected_validations.each do |validation_type| next if base.respond_to?("#{validation_type}_with_reflection") ignore_subvalidations = false base.class_eval <<-"end_eval" class << self def #{validation_type}_with_reflection(*attr_names, &block) ignoring_subvalidations(#{ignore_subvalidations}) do #{validation_type}_without_reflection(*attr_names, &block) remember_validation_metadata(:#{validation_type}, *attr_names) end end alias_method_chain :#{validation_type}, :reflection end end_eval end end |