track_history 0.0.11 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/track_history.rb CHANGED
@@ -43,8 +43,11 @@ module TrackHistory
43
43
  def define_historical_model(base, model_name, table_name, track_reference, &block)
44
44
 
45
45
  # figure out the model name
46
- model_name ||= "#{base.name}History"
47
- @klass_reference = Object.const_set(model_name, Class.new(ActiveRecord::Base))
46
+ model_name ||= "#{base.name}::History"
47
+ class_path = model_name.split(/::/)
48
+ inner_name = class_path.pop
49
+ outer = class_path.inject(Object) { |outer, inner_name| outer.const_get(inner_name) }
50
+ @klass_reference = outer.const_set(inner_name, Class.new(ActiveRecord::Base))
48
51
  @klass_reference.send(:table_name=, table_name) unless table_name.nil?
49
52
 
50
53
  unless @klass_reference.table_exists?
@@ -1,5 +1,5 @@
1
1
  module TrackHistory
2
2
 
3
- VERSION = '0.0.11'
3
+ VERSION = '0.1.0'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,97 +1,70 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: track_history
3
- version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 0
9
- - 11
10
- version: 0.0.11
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - John Crepezzi
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-01-16 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-09-16 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rspec
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70166017027660 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: mysql
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70166017027660
25
+ - !ruby/object:Gem::Dependency
26
+ name: mysql
27
+ requirement: &70166017015560 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
47
33
  type: :development
48
- version_requirements: *id002
34
+ prerelease: false
35
+ version_requirements: *70166017015560
49
36
  description: Smart, performant model auditing
50
37
  email: john.crepezzi@patch.com
51
38
  executables: []
52
-
53
39
  extensions: []
54
-
55
40
  extra_rdoc_files: []
56
-
57
- files:
41
+ files:
58
42
  - lib/track_history/historical_relation_helpers.rb
59
43
  - lib/track_history/history_methods.rb
60
44
  - lib/track_history/version.rb
61
45
  - lib/track_history.rb
62
- has_rdoc: true
63
46
  homepage: http://github.com/seejohnrun/historical
64
47
  licenses: []
65
-
66
48
  post_install_message:
67
49
  rdoc_options: []
68
-
69
- require_paths:
50
+ require_paths:
70
51
  - lib
71
- required_ruby_version: !ruby/object:Gem::Requirement
52
+ required_ruby_version: !ruby/object:Gem::Requirement
72
53
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 0
79
- version: "0"
80
- required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
59
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
89
64
  requirements: []
90
-
91
65
  rubyforge_project: historical
92
- rubygems_version: 1.3.7
66
+ rubygems_version: 1.8.10
93
67
  signing_key:
94
68
  specification_version: 3
95
69
  summary: Smart model auditing
96
70
  test_files: []
97
-