trackoid 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.8
@@ -85,22 +85,24 @@ module Mongoid #:nodoc:
85
85
  # Defines the aggregation model. It checks for class name conflicts
86
86
  def define_aggregate_model
87
87
  raise Errors::ClassAlreadyDefined.new(internal_aggregates_name) if foreign_class_defined?
88
- parent_name = self.name.underscore
88
+ parent = self
89
89
  define_klass do
90
90
  include Mongoid::Document
91
91
  include Mongoid::Tracking
92
92
 
93
93
  # Make the relation to the original class
94
- belongs_to_related parent_name.to_sym, :class_name => parent_name.camelize
94
+ belongs_to_related parent.name.demodulize.underscore.to_sym, :class_name => parent.name
95
95
 
96
96
  # Internal fields to track aggregation token and keys
97
97
  field :ns, :type => String
98
98
  field :key, :type => String
99
- index [["#{parent_name}_id".to_sym, Mongo::ASCENDING], [:ns, Mongo::ASCENDING], [:key, Mongo::ASCENDING]],
100
- :unique => true, :background => true
99
+ index [[parent.name.foreign_key.to_sym, Mongo::ASCENDING],
100
+ [:ns, Mongo::ASCENDING],
101
+ [:key, Mongo::ASCENDING]],
102
+ :unique => true, :background => true
101
103
 
102
104
  # Include parent tracking data.
103
- parent_name.camelize.constantize.tracked_fields.each {|track_field| track track_field }
105
+ parent.tracked_fields.each {|track_field| track track_field }
104
106
  end
105
107
  self.aggregate_klass = internal_aggregates_name.constantize
106
108
  end
data/trackoid.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{trackoid}
8
- s.version = "0.1.7"
8
+ s.version = "0.1.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jose Miguel Perez"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackoid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 7
10
- version: 0.1.7
9
+ - 8
10
+ version: 0.1.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jose Miguel Perez