lib/trackoid/aggregates.rb in trackoid-0.3.6 vs lib/trackoid/aggregates.rb in trackoid-0.3.7
- old
+ new
@@ -8,11 +8,11 @@
# This module includes aggregate data extensions to Trackoid instances
def self.included(base)
base.class_eval do
extend ClassMethods
- class_inheritable_accessor :aggregate_fields, :aggregate_klass
+ class_attribute :aggregate_fields, :aggregate_klass
self.aggregate_fields = {}
self.aggregate_klass = nil
delegate :aggregate_fields, :aggregate_klass, :aggregated?,
:to => "self.class"
end
@@ -83,10 +83,12 @@
(name.to_s + "_accessor").to_sym
end
# Defines the aggregation model. It checks for class name conflicts
def define_aggregate_model
- raise Errors::ClassAlreadyDefined.new(internal_aggregates_name) if foreign_class_defined?
+ unless defined?(Rails) && Rails.env.development?
+ raise Errors::ClassAlreadyDefined.new(internal_aggregates_name) if foreign_class_defined?
+ end
parent = self
define_klass do
include Mongoid::Document
include Mongoid::Tracking