some further Report lookup

pull/6827/head
Philipp Tessenow 14 years ago
parent c066d1ee6d
commit 77e3f6c93e
  1. 12
      app/models/report/chainable.rb
  2. 2
      app/models/report/sql_statement.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

@ -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

Loading…
Cancel
Save