active_record_inherit_assoc 1.0.0 → 1.1.0

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/.travis.yml CHANGED
@@ -2,6 +2,15 @@ script: "bundle exec rake test"
2
2
  rvm:
3
3
  - 1.8.7
4
4
  - 1.9.3
5
+ - 2.0
5
6
  gemfile:
6
- - gemfiles/activerecord-2.3.gemfile
7
- - gemfiles/activerecord-3.0.gemfile
7
+ - gemfiles/rails2.3.gemfile
8
+ - gemfiles/rails3.0.gemfile
9
+ - gemfiles/rails3.1.gemfile
10
+ - gemfiles/rails3.2.gemfile
11
+ matrix:
12
+ exclude:
13
+ - rvm: 2.0
14
+ gemfile: gemfiles/rails2.3.gemfile
15
+ - rvm: 2.0
16
+ gemfile: gemfiles/rails3.0.gemfile
data/Appraisals CHANGED
@@ -1,7 +1,15 @@
1
1
  appraise "rails2.3" do
2
- gem "activerecord", "2.3.14", :require => 'active_record'
2
+ gem "activerecord", "~> 2.3.14", :require => 'active_record'
3
3
  end
4
4
 
5
5
  appraise "rails3.0" do
6
- gem "activerecord", "3.0.15", :require => 'active_record'
6
+ gem "activerecord", "~> 3.0.15", :require => 'active_record'
7
+ end
8
+
9
+ appraise "rails3.1" do
10
+ gem "activerecord", "~> 3.1.0", :require => 'active_record'
11
+ end
12
+
13
+ appraise "rails3.2" do
14
+ gem "activerecord", "~> 3.2.0", :require => 'active_record'
7
15
  end
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Makes the model inherit the specified attribute from a named association.
4
4
 
5
+ Supports ActiveRecord 2.3, 3.0, 3.1, and 3.2.
6
+
5
7
  ## Install
6
8
 
7
9
  gem install active_record_inherit_assoc
@@ -1,7 +1,7 @@
1
1
  $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
2
  name = "active_record_inherit_assoc"
3
3
 
4
- Gem::Specification.new name, "1.0.0" do |s|
4
+ Gem::Specification.new name, "1.1.0" do |s|
5
5
  s.summary = "Attribute inheritance for AR associations"
6
6
  s.authors = ["Ben Osheroff"]
7
7
  s.email = ["ben@gimbo.net"]
@@ -6,12 +6,13 @@ gem "appraisal"
6
6
  gem "rake"
7
7
  gem "rails"
8
8
  gem "bundler"
9
+ gem "bump"
9
10
  gem "sqlite3"
10
11
  gem "shoulda"
11
12
  gem "jeweler"
12
13
  gem "ruby-debug", :platforms=>:ruby_18
13
14
  gem "debugger", :platforms=>:ruby_19
14
15
  gem "test-unit", ">=2.5.1"
15
- gem "activerecord", "2.3.14", :require=>"active_record"
16
+ gem "activerecord", "~> 2.3.14", :require=>"active_record"
16
17
 
17
18
  gemspec :path=>"../"
@@ -1,53 +1,53 @@
1
1
  PATH
2
- remote: /Users/mgrosser/code/tools/active_record_inherit_assoc
2
+ remote: /Users/staugaard/code/active_record_inherit_assoc
3
3
  specs:
4
- active_record_inherit_assoc (0.0.6)
4
+ active_record_inherit_assoc (1.1.0)
5
5
  activerecord
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
- actionmailer (2.3.14)
11
- actionpack (= 2.3.14)
12
- actionpack (2.3.14)
13
- activesupport (= 2.3.14)
10
+ actionmailer (2.3.18)
11
+ actionpack (= 2.3.18)
12
+ actionpack (2.3.18)
13
+ activesupport (= 2.3.18)
14
14
  rack (~> 1.1.0)
15
- activerecord (2.3.14)
16
- activesupport (= 2.3.14)
17
- activeresource (2.3.14)
18
- activesupport (= 2.3.14)
19
- activesupport (2.3.14)
20
- appraisal (0.4.1)
15
+ activerecord (2.3.18)
16
+ activesupport (= 2.3.18)
17
+ activeresource (2.3.18)
18
+ activesupport (= 2.3.18)
19
+ activesupport (2.3.18)
20
+ appraisal (0.5.2)
21
21
  bundler
22
22
  rake
23
+ bump (0.4.1)
23
24
  columnize (0.3.6)
24
- debugger (1.1.4)
25
+ debugger (1.5.0)
25
26
  columnize (>= 0.3.1)
26
- debugger-linecache (~> 1.1.1)
27
- debugger-ruby_core_source (~> 1.1.3)
28
- debugger-linecache (1.1.2)
29
- debugger-ruby_core_source (>= 1.1.1)
30
- debugger-ruby_core_source (1.1.3)
27
+ debugger-linecache (~> 1.2.0)
28
+ debugger-ruby_core_source (~> 1.2.0)
29
+ debugger-linecache (1.2.0)
30
+ debugger-ruby_core_source (1.2.0)
31
31
  git (1.2.5)
32
32
  jeweler (1.8.4)
33
33
  bundler (~> 1.0)
34
34
  git (>= 1.2.5)
35
35
  rake
36
36
  rdoc
37
- json (1.7.3)
37
+ json (1.7.7)
38
38
  linecache (0.46)
39
39
  rbx-require-relative (> 0.0.4)
40
- rack (1.1.3)
41
- rails (2.3.14)
42
- actionmailer (= 2.3.14)
43
- actionpack (= 2.3.14)
44
- activerecord (= 2.3.14)
45
- activeresource (= 2.3.14)
46
- activesupport (= 2.3.14)
40
+ rack (1.1.6)
41
+ rails (2.3.18)
42
+ actionmailer (= 2.3.18)
43
+ actionpack (= 2.3.18)
44
+ activerecord (= 2.3.18)
45
+ activeresource (= 2.3.18)
46
+ activesupport (= 2.3.18)
47
47
  rake (>= 0.8.3)
48
- rake (0.9.2.2)
48
+ rake (10.0.4)
49
49
  rbx-require-relative (0.0.9)
50
- rdoc (3.12)
50
+ rdoc (4.0.1)
51
51
  json (~> 1.4)
52
52
  ruby-debug (0.10.4)
53
53
  columnize (>= 0.1)
@@ -57,18 +57,19 @@ GEM
57
57
  shoulda (3.0.1)
58
58
  shoulda-context (~> 1.0.0)
59
59
  shoulda-matchers (~> 1.0.0)
60
- shoulda-context (1.0.0)
60
+ shoulda-context (1.0.2)
61
61
  shoulda-matchers (1.0.0)
62
- sqlite3 (1.3.6)
63
- test-unit (2.5.1)
62
+ sqlite3 (1.3.7)
63
+ test-unit (2.5.4)
64
64
 
65
65
  PLATFORMS
66
66
  ruby
67
67
 
68
68
  DEPENDENCIES
69
69
  active_record_inherit_assoc!
70
- activerecord (= 2.3.14)
70
+ activerecord (~> 2.3.14)
71
71
  appraisal
72
+ bump
72
73
  bundler
73
74
  debugger
74
75
  jeweler
@@ -6,12 +6,13 @@ gem "appraisal"
6
6
  gem "rake"
7
7
  gem "rails"
8
8
  gem "bundler"
9
+ gem "bump"
9
10
  gem "sqlite3"
10
11
  gem "shoulda"
11
12
  gem "jeweler"
12
13
  gem "ruby-debug", :platforms=>:ruby_18
13
14
  gem "debugger", :platforms=>:ruby_19
14
15
  gem "test-unit", ">=2.5.1"
15
- gem "activerecord", "3.0.15", :require=>"active_record"
16
+ gem "activerecord", "~> 3.0.15", :require=>"active_record"
16
17
 
17
18
  gemspec :path=>"../"
@@ -1,19 +1,19 @@
1
1
  PATH
2
- remote: /Users/mgrosser/code/tools/active_record_inherit_assoc
2
+ remote: /Users/staugaard/code/active_record_inherit_assoc
3
3
  specs:
4
- active_record_inherit_assoc (0.0.6)
4
+ active_record_inherit_assoc (1.1.0)
5
5
  activerecord
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
10
  abstract (1.0.0)
11
- actionmailer (3.0.15)
12
- actionpack (= 3.0.15)
11
+ actionmailer (3.0.20)
12
+ actionpack (= 3.0.20)
13
13
  mail (~> 2.2.19)
14
- actionpack (3.0.15)
15
- activemodel (= 3.0.15)
16
- activesupport (= 3.0.15)
14
+ actionpack (3.0.20)
15
+ activemodel (= 3.0.20)
16
+ activesupport (= 3.0.20)
17
17
  builder (~> 2.1.2)
18
18
  erubis (~> 2.6.6)
19
19
  i18n (~> 0.5.0)
@@ -21,32 +21,31 @@ GEM
21
21
  rack-mount (~> 0.6.14)
22
22
  rack-test (~> 0.5.7)
23
23
  tzinfo (~> 0.3.23)
24
- activemodel (3.0.15)
25
- activesupport (= 3.0.15)
24
+ activemodel (3.0.20)
25
+ activesupport (= 3.0.20)
26
26
  builder (~> 2.1.2)
27
27
  i18n (~> 0.5.0)
28
- activerecord (3.0.15)
29
- activemodel (= 3.0.15)
30
- activesupport (= 3.0.15)
28
+ activerecord (3.0.20)
29
+ activemodel (= 3.0.20)
30
+ activesupport (= 3.0.20)
31
31
  arel (~> 2.0.10)
32
32
  tzinfo (~> 0.3.23)
33
- activeresource (3.0.15)
34
- activemodel (= 3.0.15)
35
- activesupport (= 3.0.15)
36
- activesupport (3.0.15)
37
- appraisal (0.4.1)
33
+ activesupport (3.0.20)
34
+ appraisal (0.5.2)
38
35
  bundler
39
36
  rake
40
37
  arel (2.0.10)
38
+ bourne (1.4.0)
39
+ mocha (~> 0.13.2)
41
40
  builder (2.1.2)
41
+ bump (0.4.1)
42
42
  columnize (0.3.6)
43
- debugger (1.1.4)
43
+ debugger (1.5.0)
44
44
  columnize (>= 0.3.1)
45
- debugger-linecache (~> 1.1.1)
46
- debugger-ruby_core_source (~> 1.1.3)
47
- debugger-linecache (1.1.2)
48
- debugger-ruby_core_source (>= 1.1.1)
49
- debugger-ruby_core_source (1.1.3)
45
+ debugger-linecache (~> 1.2.0)
46
+ debugger-ruby_core_source (~> 1.2.0)
47
+ debugger-linecache (1.2.0)
48
+ debugger-ruby_core_source (1.2.0)
50
49
  erubis (2.6.6)
51
50
  abstract (>= 1.0.0)
52
51
  git (1.2.5)
@@ -56,7 +55,7 @@ GEM
56
55
  git (>= 1.2.5)
57
56
  rake
58
57
  rdoc
59
- json (1.7.3)
58
+ json (1.7.7)
60
59
  linecache (0.46)
61
60
  rbx-require-relative (> 0.0.4)
62
61
  mail (2.2.19)
@@ -64,56 +63,52 @@ GEM
64
63
  i18n (>= 0.4.0)
65
64
  mime-types (~> 1.16)
66
65
  treetop (~> 1.4.8)
67
- mime-types (1.19)
66
+ metaclass (0.0.1)
67
+ mime-types (1.23)
68
+ mocha (0.13.3)
69
+ metaclass (~> 0.0.1)
68
70
  polyglot (0.3.3)
69
- rack (1.2.5)
71
+ rack (1.2.8)
70
72
  rack-mount (0.6.14)
71
73
  rack (>= 1.0.0)
72
74
  rack-test (0.5.7)
73
75
  rack (>= 1.0)
74
- rails (3.0.15)
75
- actionmailer (= 3.0.15)
76
- actionpack (= 3.0.15)
77
- activerecord (= 3.0.15)
78
- activeresource (= 3.0.15)
79
- activesupport (= 3.0.15)
80
- bundler (~> 1.0)
81
- railties (= 3.0.15)
82
- railties (3.0.15)
83
- actionpack (= 3.0.15)
84
- activesupport (= 3.0.15)
85
- rake (>= 0.8.7)
86
- rdoc (~> 3.4)
87
- thor (~> 0.14.4)
88
- rake (0.9.2.2)
76
+ rails (0.9.5)
77
+ actionmailer (>= 0.6.1)
78
+ actionpack (>= 1.4.0)
79
+ activerecord (>= 1.6.0)
80
+ rake (>= 0.4.15)
81
+ rake (10.0.4)
89
82
  rbx-require-relative (0.0.9)
90
- rdoc (3.12)
83
+ rdoc (4.0.1)
91
84
  json (~> 1.4)
92
85
  ruby-debug (0.10.4)
93
86
  columnize (>= 0.1)
94
87
  ruby-debug-base (~> 0.10.4.0)
95
88
  ruby-debug-base (0.10.4)
96
89
  linecache (>= 0.3)
97
- shoulda (3.0.1)
98
- shoulda-context (~> 1.0.0)
99
- shoulda-matchers (~> 1.0.0)
100
- shoulda-context (1.0.0)
101
- shoulda-matchers (1.0.0)
102
- sqlite3 (1.3.6)
103
- test-unit (2.5.1)
104
- thor (0.14.6)
105
- treetop (1.4.10)
90
+ shoulda (3.4.0)
91
+ shoulda-context (~> 1.0, >= 1.0.1)
92
+ shoulda-matchers (~> 1.0, >= 1.4.1)
93
+ shoulda-context (1.1.1)
94
+ shoulda-matchers (1.5.6)
95
+ activesupport (>= 3.0.0)
96
+ bourne (~> 1.3)
97
+ sqlite3 (1.3.7)
98
+ test-unit (2.5.4)
99
+ treetop (1.4.12)
106
100
  polyglot
107
101
  polyglot (>= 0.3.1)
108
- tzinfo (0.3.33)
102
+ tzinfo (0.3.37)
109
103
 
110
104
  PLATFORMS
111
105
  ruby
112
106
 
113
107
  DEPENDENCIES
114
108
  active_record_inherit_assoc!
115
- activerecord (= 3.0.15)
109
+ activerecord (~> 3.0.15)
116
110
  appraisal
111
+ bump
117
112
  bundler
118
113
  debugger
119
114
  jeweler
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source :rubygems
4
+
5
+ gem "appraisal"
6
+ gem "rake"
7
+ gem "rails"
8
+ gem "bundler"
9
+ gem "bump"
10
+ gem "sqlite3"
11
+ gem "shoulda"
12
+ gem "jeweler"
13
+ gem "ruby-debug", :platforms=>:ruby_18
14
+ gem "debugger", :platforms=>:ruby_19
15
+ gem "test-unit", ">=2.5.1"
16
+ gem "activerecord", "~> 3.1.0", :require=>"active_record"
17
+
18
+ gemspec :path=>"../"
@@ -0,0 +1,128 @@
1
+ PATH
2
+ remote: /Users/staugaard/code/active_record_inherit_assoc
3
+ specs:
4
+ active_record_inherit_assoc (1.1.0)
5
+ activerecord
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.1.12)
11
+ actionpack (= 3.1.12)
12
+ mail (~> 2.4.4)
13
+ actionpack (3.1.12)
14
+ activemodel (= 3.1.12)
15
+ activesupport (= 3.1.12)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ i18n (~> 0.6)
19
+ rack (~> 1.3.6)
20
+ rack-cache (~> 1.2)
21
+ rack-mount (~> 0.8.2)
22
+ rack-test (~> 0.6.1)
23
+ sprockets (~> 2.0.4)
24
+ activemodel (3.1.12)
25
+ activesupport (= 3.1.12)
26
+ builder (~> 3.0.0)
27
+ i18n (~> 0.6)
28
+ activerecord (3.1.12)
29
+ activemodel (= 3.1.12)
30
+ activesupport (= 3.1.12)
31
+ arel (~> 2.2.3)
32
+ tzinfo (~> 0.3.29)
33
+ activesupport (3.1.12)
34
+ multi_json (~> 1.0)
35
+ appraisal (0.5.2)
36
+ bundler
37
+ rake
38
+ arel (2.2.3)
39
+ bourne (1.4.0)
40
+ mocha (~> 0.13.2)
41
+ builder (3.0.4)
42
+ bump (0.4.1)
43
+ columnize (0.3.6)
44
+ debugger (1.5.0)
45
+ columnize (>= 0.3.1)
46
+ debugger-linecache (~> 1.2.0)
47
+ debugger-ruby_core_source (~> 1.2.0)
48
+ debugger-linecache (1.2.0)
49
+ debugger-ruby_core_source (1.2.0)
50
+ erubis (2.7.0)
51
+ git (1.2.5)
52
+ hike (1.2.2)
53
+ i18n (0.6.4)
54
+ jeweler (1.8.4)
55
+ bundler (~> 1.0)
56
+ git (>= 1.2.5)
57
+ rake
58
+ rdoc
59
+ json (1.7.7)
60
+ linecache (0.46)
61
+ rbx-require-relative (> 0.0.4)
62
+ mail (2.4.4)
63
+ i18n (>= 0.4.0)
64
+ mime-types (~> 1.16)
65
+ treetop (~> 1.4.8)
66
+ metaclass (0.0.1)
67
+ mime-types (1.23)
68
+ mocha (0.13.3)
69
+ metaclass (~> 0.0.1)
70
+ multi_json (1.7.2)
71
+ polyglot (0.3.3)
72
+ rack (1.3.10)
73
+ rack-cache (1.2)
74
+ rack (>= 0.4)
75
+ rack-mount (0.8.3)
76
+ rack (>= 1.0.0)
77
+ rack-test (0.6.2)
78
+ rack (>= 1.0)
79
+ rails (0.9.5)
80
+ actionmailer (>= 0.6.1)
81
+ actionpack (>= 1.4.0)
82
+ activerecord (>= 1.6.0)
83
+ rake (>= 0.4.15)
84
+ rake (10.0.4)
85
+ rbx-require-relative (0.0.9)
86
+ rdoc (4.0.1)
87
+ json (~> 1.4)
88
+ ruby-debug (0.10.4)
89
+ columnize (>= 0.1)
90
+ ruby-debug-base (~> 0.10.4.0)
91
+ ruby-debug-base (0.10.4)
92
+ linecache (>= 0.3)
93
+ shoulda (3.4.0)
94
+ shoulda-context (~> 1.0, >= 1.0.1)
95
+ shoulda-matchers (~> 1.0, >= 1.4.1)
96
+ shoulda-context (1.1.1)
97
+ shoulda-matchers (1.5.6)
98
+ activesupport (>= 3.0.0)
99
+ bourne (~> 1.3)
100
+ sprockets (2.0.4)
101
+ hike (~> 1.2)
102
+ rack (~> 1.0)
103
+ tilt (~> 1.1, != 1.3.0)
104
+ sqlite3 (1.3.7)
105
+ test-unit (2.5.4)
106
+ tilt (1.4.0)
107
+ treetop (1.4.12)
108
+ polyglot
109
+ polyglot (>= 0.3.1)
110
+ tzinfo (0.3.37)
111
+
112
+ PLATFORMS
113
+ ruby
114
+
115
+ DEPENDENCIES
116
+ active_record_inherit_assoc!
117
+ activerecord (~> 3.1.0)
118
+ appraisal
119
+ bump
120
+ bundler
121
+ debugger
122
+ jeweler
123
+ rails
124
+ rake
125
+ ruby-debug
126
+ shoulda
127
+ sqlite3
128
+ test-unit (>= 2.5.1)
@@ -0,0 +1,18 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source :rubygems
4
+
5
+ gem "appraisal"
6
+ gem "rake"
7
+ gem "rails"
8
+ gem "bundler"
9
+ gem "bump"
10
+ gem "sqlite3"
11
+ gem "shoulda"
12
+ gem "jeweler"
13
+ gem "ruby-debug", :platforms=>:ruby_18
14
+ gem "debugger", :platforms=>:ruby_19
15
+ gem "test-unit", ">=2.5.1"
16
+ gem "activerecord", "~> 3.2.0", :require=>"active_record"
17
+
18
+ gemspec :path=>"../"
@@ -0,0 +1,127 @@
1
+ PATH
2
+ remote: /Users/staugaard/code/active_record_inherit_assoc
3
+ specs:
4
+ active_record_inherit_assoc (1.1.0)
5
+ activerecord
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.2.13)
11
+ actionpack (= 3.2.13)
12
+ mail (~> 2.5.3)
13
+ actionpack (3.2.13)
14
+ activemodel (= 3.2.13)
15
+ activesupport (= 3.2.13)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ journey (~> 1.0.4)
19
+ rack (~> 1.4.5)
20
+ rack-cache (~> 1.2)
21
+ rack-test (~> 0.6.1)
22
+ sprockets (~> 2.2.1)
23
+ activemodel (3.2.13)
24
+ activesupport (= 3.2.13)
25
+ builder (~> 3.0.0)
26
+ activerecord (3.2.13)
27
+ activemodel (= 3.2.13)
28
+ activesupport (= 3.2.13)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activesupport (3.2.13)
32
+ i18n (= 0.6.1)
33
+ multi_json (~> 1.0)
34
+ appraisal (0.5.2)
35
+ bundler
36
+ rake
37
+ arel (3.0.2)
38
+ bourne (1.4.0)
39
+ mocha (~> 0.13.2)
40
+ builder (3.0.4)
41
+ bump (0.4.1)
42
+ columnize (0.3.6)
43
+ debugger (1.5.0)
44
+ columnize (>= 0.3.1)
45
+ debugger-linecache (~> 1.2.0)
46
+ debugger-ruby_core_source (~> 1.2.0)
47
+ debugger-linecache (1.2.0)
48
+ debugger-ruby_core_source (1.2.0)
49
+ erubis (2.7.0)
50
+ git (1.2.5)
51
+ hike (1.2.2)
52
+ i18n (0.6.1)
53
+ jeweler (1.8.4)
54
+ bundler (~> 1.0)
55
+ git (>= 1.2.5)
56
+ rake
57
+ rdoc
58
+ journey (1.0.4)
59
+ json (1.7.7)
60
+ linecache (0.46)
61
+ rbx-require-relative (> 0.0.4)
62
+ mail (2.5.3)
63
+ i18n (>= 0.4.0)
64
+ mime-types (~> 1.16)
65
+ treetop (~> 1.4.8)
66
+ metaclass (0.0.1)
67
+ mime-types (1.23)
68
+ mocha (0.13.3)
69
+ metaclass (~> 0.0.1)
70
+ multi_json (1.7.2)
71
+ polyglot (0.3.3)
72
+ rack (1.4.5)
73
+ rack-cache (1.2)
74
+ rack (>= 0.4)
75
+ rack-test (0.6.2)
76
+ rack (>= 1.0)
77
+ rails (0.9.5)
78
+ actionmailer (>= 0.6.1)
79
+ actionpack (>= 1.4.0)
80
+ activerecord (>= 1.6.0)
81
+ rake (>= 0.4.15)
82
+ rake (10.0.4)
83
+ rbx-require-relative (0.0.9)
84
+ rdoc (4.0.1)
85
+ json (~> 1.4)
86
+ ruby-debug (0.10.4)
87
+ columnize (>= 0.1)
88
+ ruby-debug-base (~> 0.10.4.0)
89
+ ruby-debug-base (0.10.4)
90
+ linecache (>= 0.3)
91
+ shoulda (3.4.0)
92
+ shoulda-context (~> 1.0, >= 1.0.1)
93
+ shoulda-matchers (~> 1.0, >= 1.4.1)
94
+ shoulda-context (1.1.1)
95
+ shoulda-matchers (1.5.6)
96
+ activesupport (>= 3.0.0)
97
+ bourne (~> 1.3)
98
+ sprockets (2.2.2)
99
+ hike (~> 1.2)
100
+ multi_json (~> 1.0)
101
+ rack (~> 1.0)
102
+ tilt (~> 1.1, != 1.3.0)
103
+ sqlite3 (1.3.7)
104
+ test-unit (2.5.4)
105
+ tilt (1.4.0)
106
+ treetop (1.4.12)
107
+ polyglot
108
+ polyglot (>= 0.3.1)
109
+ tzinfo (0.3.37)
110
+
111
+ PLATFORMS
112
+ ruby
113
+
114
+ DEPENDENCIES
115
+ active_record_inherit_assoc!
116
+ activerecord (~> 3.2.0)
117
+ appraisal
118
+ bump
119
+ bundler
120
+ debugger
121
+ jeweler
122
+ rails
123
+ rake
124
+ ruby-debug
125
+ shoulda
126
+ sqlite3
127
+ test-unit (>= 2.5.1)
@@ -1,12 +1,10 @@
1
1
  require 'active_record'
2
- require 'active_record/base'
3
- require 'active_record/reflection'
4
- require 'active_record/associations/association_proxy'
5
- require 'active_record/associations/association_collection'
6
2
 
7
- ActiveRecord::Base.valid_keys_for_has_many_association << :inherit
8
- ActiveRecord::Base.valid_keys_for_has_one_association << :inherit
9
- ActiveRecord::Base.valid_keys_for_belongs_to_association << :inherit
3
+ if ActiveRecord::VERSION::STRING < "3.1"
4
+ require 'active_record_inherit_assoc/ar_23_and_30'
5
+ else
6
+ require 'active_record_inherit_assoc/ar_31_and_32'
7
+ end
10
8
 
11
9
  class ActiveRecord::Base
12
10
  # Makes the model inherit the specified attribute from a named association.
@@ -35,69 +33,3 @@ class ActiveRecord::Base
35
33
  end
36
34
  end
37
35
  end
38
-
39
- module ActiveRecord
40
- module Associations
41
- AssociationProxy.class_eval do
42
- def conditions_with_value_inheritance
43
- return conditions_without_value_inheritance unless @reflection.klass.respond_to?(:sanitize_sql) # ActiveHash TODO test this!
44
- copied_merge_conditions(attribute_inheritance_hash, conditions_without_value_inheritance)
45
- end
46
-
47
- alias_method_chain :conditions, :value_inheritance
48
-
49
- private
50
-
51
- # copied from activerecord 2.3 to fix compatability with 3.0
52
- # Merges conditions so that the result is a valid +condition+
53
- def copied_merge_conditions(*conditions)
54
- segments = []
55
-
56
- conditions.each do |condition|
57
- unless condition.blank?
58
- sql = sanitize_sql(condition)
59
- segments << sql unless sql.blank?
60
- end
61
- end
62
-
63
- "(#{segments.join(') AND (')})" unless segments.empty?
64
- end
65
-
66
- def attribute_inheritance_hash
67
- return {} unless @reflection.options[:inherit]
68
- Array(@reflection.options[:inherit]).inject({}) { |hash, obj| hash[obj] = @owner.send(obj) ; hash }
69
- end
70
- end
71
-
72
- AssociationCollection.class_eval do
73
- # this is *maybe* not the correct place to patch in, but it covers all the cases
74
- # without having to patch build, create, create!, etc
75
- def add_record_to_target_with_callbacks_with_value_inheritance(record, &block)
76
- attribute_inheritance_hash.each do |k, v|
77
- record[k] = v
78
- end
79
- add_record_to_target_with_callbacks_without_value_inheritance(record, &block)
80
- end
81
-
82
- alias_method_chain :add_record_to_target_with_callbacks, :value_inheritance
83
- end
84
-
85
- HasOneAssociation.class_eval do
86
- def create_with_value_inheritance(attrs = {}, replace_existing = true)
87
- attrs ||= {}
88
- create_without_value_inheritance(attribute_inheritance_hash.merge(attrs), replace_existing)
89
- end
90
-
91
- def create_with_value_inheritance!(attrs = {}, replace_existing = true)
92
- attrs ||= {}
93
- create_without_value_inheritance!(attribute_inheritance_hash.merge(attrs), replace_existing)
94
- end
95
-
96
- def build_with_value_inheritance(attrs = {}, replace_existing = true)
97
- attrs ||= {}
98
- build_without_value_inheritance(attribute_inheritance_hash.merge(attrs), replace_existing)
99
- end
100
- [:create, :create!, :build].each { |sym| alias_method_chain sym, :value_inheritance }
101
- end
102
- end
103
- end
@@ -0,0 +1,75 @@
1
+ require 'active_record'
2
+ require 'active_record/base'
3
+ require 'active_record/reflection'
4
+ require 'active_record/associations/association_proxy'
5
+ require 'active_record/associations/association_collection'
6
+
7
+ ActiveRecord::Base.valid_keys_for_has_many_association << :inherit
8
+ ActiveRecord::Base.valid_keys_for_has_one_association << :inherit
9
+ ActiveRecord::Base.valid_keys_for_belongs_to_association << :inherit
10
+
11
+ module ActiveRecord
12
+ module Associations
13
+ AssociationProxy.class_eval do
14
+ def conditions_with_value_inheritance
15
+ return conditions_without_value_inheritance unless @reflection.klass.respond_to?(:sanitize_sql) # ActiveHash TODO test this!
16
+ copied_merge_conditions(attribute_inheritance_hash, conditions_without_value_inheritance)
17
+ end
18
+
19
+ alias_method_chain :conditions, :value_inheritance
20
+
21
+ private
22
+
23
+ # copied from activerecord 2.3 to fix compatability with 3.0
24
+ # Merges conditions so that the result is a valid +condition+
25
+ def copied_merge_conditions(*conditions)
26
+ segments = []
27
+
28
+ conditions.each do |condition|
29
+ unless condition.blank?
30
+ sql = sanitize_sql(condition)
31
+ segments << sql unless sql.blank?
32
+ end
33
+ end
34
+
35
+ "(#{segments.join(') AND (')})" unless segments.empty?
36
+ end
37
+
38
+ def attribute_inheritance_hash
39
+ return {} unless @reflection.options[:inherit]
40
+ Array(@reflection.options[:inherit]).inject({}) { |hash, obj| hash[obj] = @owner.send(obj) ; hash }
41
+ end
42
+ end
43
+
44
+ AssociationCollection.class_eval do
45
+ # this is *maybe* not the correct place to patch in, but it covers all the cases
46
+ # without having to patch build, create, create!, etc
47
+ def add_record_to_target_with_callbacks_with_value_inheritance(record, &block)
48
+ attribute_inheritance_hash.each do |k, v|
49
+ record[k] = v
50
+ end
51
+ add_record_to_target_with_callbacks_without_value_inheritance(record, &block)
52
+ end
53
+
54
+ alias_method_chain :add_record_to_target_with_callbacks, :value_inheritance
55
+ end
56
+
57
+ HasOneAssociation.class_eval do
58
+ def create_with_value_inheritance(attrs = {}, replace_existing = true)
59
+ attrs ||= {}
60
+ create_without_value_inheritance(attribute_inheritance_hash.merge(attrs), replace_existing)
61
+ end
62
+
63
+ def create_with_value_inheritance!(attrs = {}, replace_existing = true)
64
+ attrs ||= {}
65
+ create_without_value_inheritance!(attribute_inheritance_hash.merge(attrs), replace_existing)
66
+ end
67
+
68
+ def build_with_value_inheritance(attrs = {}, replace_existing = true)
69
+ attrs ||= {}
70
+ build_without_value_inheritance(attribute_inheritance_hash.merge(attrs), replace_existing)
71
+ end
72
+ [:create, :create!, :build].each { |sym| alias_method_chain sym, :value_inheritance }
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,22 @@
1
+ require 'active_record'
2
+
3
+ ActiveRecord::Associations::Builder::HasMany.valid_options << :inherit
4
+ ActiveRecord::Associations::Builder::HasOne.valid_options << :inherit
5
+ ActiveRecord::Associations::Builder::BelongsTo.valid_options << :inherit
6
+
7
+ ActiveRecord::Associations::Association.class_eval do
8
+ def association_scope_with_value_inheritance
9
+ if inherited_attributes = attribute_inheritance_hash
10
+ association_scope_without_value_inheritance.where(inherited_attributes)
11
+ else
12
+ association_scope_without_value_inheritance
13
+ end
14
+ end
15
+
16
+ alias_method_chain :association_scope, :value_inheritance
17
+
18
+ def attribute_inheritance_hash
19
+ return nil unless reflection.options[:inherit]
20
+ Array(reflection.options[:inherit]).inject({}) { |hash, obj| hash[obj] = owner.send(obj) ; hash }
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_inherit_assoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-18 00:00:00.000000000 Z
12
+ date: 2013-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -46,7 +46,13 @@ files:
46
46
  - gemfiles/rails2.3.gemfile.lock
47
47
  - gemfiles/rails3.0.gemfile
48
48
  - gemfiles/rails3.0.gemfile.lock
49
+ - gemfiles/rails3.1.gemfile
50
+ - gemfiles/rails3.1.gemfile.lock
51
+ - gemfiles/rails3.2.gemfile
52
+ - gemfiles/rails3.2.gemfile.lock
49
53
  - lib/active_record_inherit_assoc.rb
54
+ - lib/active_record_inherit_assoc/ar_23_and_30.rb
55
+ - lib/active_record_inherit_assoc/ar_31_and_32.rb
50
56
  - test/helper.rb
51
57
  - test/schema.rb
52
58
  - test/test_belongs_to_association.rb
@@ -66,7 +72,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
72
  version: '0'
67
73
  segments:
68
74
  - 0
69
- hash: 4610842914656377483
75
+ hash: 738801861665246186
70
76
  required_rubygems_version: !ruby/object:Gem::Requirement
71
77
  none: false
72
78
  requirements:
@@ -75,10 +81,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
81
  version: '0'
76
82
  segments:
77
83
  - 0
78
- hash: 4610842914656377483
84
+ hash: 738801861665246186
79
85
  requirements: []
80
86
  rubyforge_project:
81
- rubygems_version: 1.8.24
87
+ rubygems_version: 1.8.25
82
88
  signing_key:
83
89
  specification_version: 3
84
90
  summary: Attribute inheritance for AR associations