From 77e3f6c93e5354a99e0ee7cc861f881f17b3f908 Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Fri, 3 Dec 2010 17:42:12 +0100 Subject: [PATCH] some further Report lookup --- app/models/report/chainable.rb | 12 ++++++------ app/models/report/sql_statement.rb | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/report/chainable.rb b/app/models/report/chainable.rb index 2fa4426b77..ab1ff445c0 100644 --- a/app/models/report/chainable.rb +++ b/app/models/report/chainable.rb @@ -3,14 +3,14 @@ class Report < ActiveRecord::Base class Chainable include Enumerable - include Report::QueryUtils - extend Report::InheritedAttribute + include Report.lookup::QueryUtils + extend Report.lookup::InheritedAttribute # this attr. should point to a symbol useable for translations inherited_attribute :applies_for, :default => :label_cost_entry_attributes def self.accepts_property(*list) - Report.accepted_properties.push(*list.map(&:to_s)) + Report.lookup.accepted_properties.push(*list.map(&:to_s)) end def self.chain_list(*list) @@ -67,7 +67,7 @@ class Report < ActiveRecord::Base # Example: # initialize_query_with { |query| query.filter Report::Filter::City, :operators => '=', :values => 'Berlin, da great City' } def self.initialize_query_with(&block) - Report.chain_initializer.push block + Report.lookup.chain_initializer.push block end inherited_attribute :label @@ -124,7 +124,7 @@ class Report < ActiveRecord::Base @options = options options.each do |key, value| unless self.class.extra_options.include? key - raise ArgumentError, "may not set #{key}" unless Report.accepted_properties.include? key.to_s + raise ArgumentError, "may not set #{key}" unless Report.lookup.accepted_properties.include? key.to_s send "#{key}=", value if value end end @@ -198,7 +198,7 @@ class Report < ActiveRecord::Base end def compute_result - Result.new ActiveRecord::Base.connection.select_all(sql_statement.to_s), {}, type + Report.lookup::Result.new ActiveRecord::Base.connection.select_all(sql_statement.to_s), {}, type end def table_joins diff --git a/app/models/report/sql_statement.rb b/app/models/report/sql_statement.rb index 560695d5bc..8777fef9fb 100644 --- a/app/models/report/sql_statement.rb +++ b/app/models/report/sql_statement.rb @@ -20,7 +20,7 @@ class Report::SqlStatement end end - include Report::QueryUtils + include Report.lookup::QueryUtils ## # Describes the query. This may be used in a sql-comment later. attr_accessor :desc