2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/models/team.rb', line 2
def self.extended(base)
begin
if Setting.location_metric.present?
base.belongs_to :team, {
:class_name => 'Metric',
:conditions => ["metrics.ancestry is not null and "+
"metrics.ancestry = ? or metrics.ancestry like '?/%'",
Setting.location_metric.try(:id), Setting.location_metric.try(:id)]
}
else
base.belongs_to :team, :class_name => 'Metric'
end
rescue ActiveRecord::StatementInvalid => e
Rails.logger.info "Bad if seen in operation: {e.class} #{e.message}"
Rails.logger.info "#{e.class} #{e.message}\n"
end
end
|