fix query utils propagation when used in other modules (validations, "inherited" query utils, ...)

pull/6827/head
Konstantin Haase 14 years ago
parent 323038e84c
commit b405e0a5dd
  1. 11
      lib/report/query_utils.rb
  2. 2
      lib/report/validation.rb

@ -4,6 +4,17 @@ module Report::QueryUtils
delegate :quoted_false, :quoted_true, :to => "ActiveRecord::Base.connection"
attr_writer :engine
module PropagationHook
def append_features(base)
ancestors[1..-1].reverse_each { |m| base.send(:include, m) }
base.extend PropagationHook
base.extend self
super
end
end
extend PropagationHook
##
# Subclass of Report to be used for constant lookup and such.
# It is considered public API to override this method i.e. in Tests.

@ -14,7 +14,7 @@ module Report::Validation
def register_validation(val_method)
const_name = val_method.to_s.camelize
begin
val_module = Report::Validation.const_get const_name
val_module = engine::Validation.const_get const_name
singleton_class.send(:include, val_module)
val_method = "validate_" + val_method.to_s.pluralize
if method(val_method)

Loading…
Cancel
Save