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 " class << self\n def \#{validation_type}_with_reflection(*attr_names, &block)\n ignoring_subvalidations(\#{ignore_subvalidations}) do\n \#{validation_type}_without_reflection(*attr_names, &block)\n remember_validation_metadata(:\#{validation_type}, *attr_names)\n end\n end\n\n alias_method_chain :\#{validation_type}, :reflection\n end\n end_eval\n end\nend\n" |