delegate Chainable calls of #table_joins, #table_name, #field, #display?, #help_text and #underscore_name to class

pull/6827/head
jwollert 14 years ago
parent ad7fd19961
commit 3f749fa8cd
  1. 22
      lib/report/chainable.rb

@ -5,9 +5,11 @@ class Report < ActiveRecord::Base
include Enumerable
include Report::QueryUtils
extend Report::InheritedAttribute
extend Forwardable
# this attr. should point to a symbol useable for translations
inherited_attribute :applies_for, :default => :label_cost_entry_attributes
def_delegators :'self.class', :table_joins, :table_name, :field, :display?, :help_text, :underscore_name
def self.accepts_property(*list)
engine.accepted_properties.push(*list.map(&:to_s))
@ -213,10 +215,6 @@ class Report < ActiveRecord::Base
engine::Result.new engine.reporting_connection.select_all(sql_statement.to_s), {}, type
end
def table_joins
self.class.table_joins
end
def cached(*args)
@cached ||= {}
@cached[args] ||= send(*args)
@ -286,14 +284,6 @@ class Report < ActiveRecord::Base
@table_name || last_table
end
def display?
self.class.display?
end
def table_name
self.class.table_name
end
def with_table(fields)
fields.map do |f|
place_field_name = self.class.put_sql_table_names[f] || self.class.put_sql_table_names[f].nil?
@ -301,10 +291,6 @@ class Report < ActiveRecord::Base
end
end
def field
self.class.field
end
def mapping
self.class.method(:mapping).to_proc
end
@ -320,10 +306,6 @@ class Report < ActiveRecord::Base
@field_map[field]
end
def help_text
self.class.help_text
end
##
# Sets a help text to be displayed for this kind of Chainable.
def self.help_text=(sym)

Loading…
Cancel
Save