use engine of queryutils module in validation for validation const discovery

pull/6827/head
jwollert 14 years ago
parent 71e59313d1
commit c46a111691
  1. 1
      lib/report/query_utils.rb
  2. 9
      lib/report/validation.rb

@ -224,4 +224,5 @@ module Report::QueryUtils
super super
klass.extend self klass.extend self
end end
end end

@ -1,6 +1,6 @@
module Report::Validation module Report::Validation
extend ProactiveAutoloader extend ProactiveAutoloader
include Report::QueryUtils
# autoload :Dates, 'report/validation/dates' # autoload :Dates, 'report/validation/dates'
# autoload :Integers, 'report/validation/integers' # autoload :Integers, 'report/validation/integers'
# autoload :Sql, 'report/validation/sql' # autoload :Sql, 'report/validation/sql'
@ -14,7 +14,7 @@ module Report::Validation
def register_validation(val_method) def register_validation(val_method)
const_name = val_method.to_s.camelize const_name = val_method.to_s.camelize
begin begin
val_module = Report::Validation.const_get const_name val_module = engine::Validation.const_get const_name
singleton_class.send(:include, val_module) singleton_class.send(:include, val_module)
val_method = "validate_" + val_method.to_s.pluralize val_method = "validate_" + val_method.to_s.pluralize
if method(val_method) if method(val_method)
@ -44,4 +44,9 @@ module Report::Validation
end end
end end
def self.included(klass)
super
klass.send :include, Report::QueryUtils
end
end end

Loading…
Cancel
Save