Sha256: 6b77c57473ca88fa95d952493cd4087825bf489ec05f5fa028455c66b07067ec
Contents?: true
Size: 634 Bytes
Versions: 1
Compression:
Stored size: 634 Bytes
Contents
module ClarkKent class ReportColumn < ActiveRecord::Base include Cloneable SummaryMethods = ['total','average'] attr_accessible :report_id, :column_name, :column_order, :report_sort, :summary_method belongs_to :report scope :sorted, -> { order("clark_kent_report_columns.column_order") } def report_sort_pretty {'ascending' => 'A->Z','descending' => 'Z->A'}[self.report_sort] end def calculate_summary(values) return nil unless self.summary_method.present? values.send self.summary_method end def summarizable? report.column_options_for(self.column_name).respond_to? :summarizable end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
clark_kent-0.0.1 | app/models/clark_kent/report_column.rb |