9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/micro/attributes/features/activemodel_validations.rb', line 9
def self.included(base)
if !@@__active_model_load_error && !@@__active_model_required
begin
require 'active_model'
rescue LoadError => e
@@__active_model_load_error = true
end
@@__active_model_required = true
end
unless @@__active_model_load_error
base.send(:include, ::ActiveModel::Validations)
if ::ActiveModel::VERSION::STRING >= '3.2'
base.class_eval(" def initialize(options)\n self.attributes=(options)\n run_validations!\n end\n RUBY\n end\n end\nend\n")
|