grouped_scope 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,4 +2,7 @@ rvm:
2
2
  - 1.8.7
3
3
  - 1.9.2
4
4
  - 1.9.3
5
- - ree
5
+ - ree
6
+ gemfile:
7
+ - Gemfile.rails-3.1
8
+ - Gemfile.rails-3.2
data/CHANGELOG CHANGED
@@ -1,9 +1,9 @@
1
1
 
2
2
  = master
3
3
 
4
- = 3.1.0 (unreleased)
4
+ = 3.1.0
5
5
 
6
- * Works with ActiveRecord 3.1
6
+ * Works with ActiveRecord 3.1 or 3.2
7
7
 
8
8
  * The group object is now an ActiveRecord::Relation so you can further scope it.
9
9
 
data/Gemfile CHANGED
@@ -1,21 +1 @@
1
-
2
- source :rubygems
3
- source 'http://gems.github.com/'
4
-
5
- spec = eval(File.read('grouped_scope.gemspec'))
6
- ar_version = spec.dependencies.detect{ |d|d.name == 'activerecord' }.requirement.to_s
7
- ar_version = ENV['RAILS_VERSION'] || ar_version
8
-
9
- gem 'sqlite3', '1.3.4'
10
- gem 'activerecord', ar_version, :require => 'active_record'
11
-
12
- group :development do
13
- gem 'rake', '~> 0.9.2'
14
- end
15
-
16
- group :test do
17
- gem 'minitest', '~> 2.8.1'
18
- gem 'factory_girl', '~> 2.3.2'
19
- gem 'mocha', '~> 0.10.0'
20
- end
21
-
1
+ eval File.read('Gemfile.rails-3.1')
@@ -0,0 +1,9 @@
1
+ source :rubygems
2
+
3
+ spec = eval File.read('grouped_scope.gemspec')
4
+ deps = spec.dependencies.map { |dep| {:name => dep.name, :version => dep.requirement.to_s} }
5
+
6
+ deps.reject! { |dep| dep[:name] =~ /activerecord/ }
7
+ deps.each { |dep| gem dep[:name], dep[:version] }
8
+
9
+ gem 'activerecord', '~> 3.1.3'
@@ -0,0 +1,9 @@
1
+ source :rubygems
2
+
3
+ spec = eval File.read('grouped_scope.gemspec')
4
+ deps = spec.dependencies.map { |dep| {:name => dep.name, :version => dep.requirement.to_s} }
5
+
6
+ deps.reject! { |dep| dep[:name] =~ /activerecord/ }
7
+ deps.each { |dep| gem dep[:name], dep[:version] }
8
+
9
+ gem 'activerecord', '3.2.0.rc1'
data/Rakefile CHANGED
@@ -1,14 +1,13 @@
1
- require 'rake'
1
+ require 'bundler'
2
2
  require 'rake/testtask'
3
3
 
4
- desc 'Default: run unit tests.'
5
- task :default => :test
4
+ Bundler::GemHelper.install_tasks
6
5
 
7
6
  desc 'Test the GroupedScope plugin.'
8
7
  Rake::TestTask.new do |t|
9
- t.libs << 'lib'
10
- t.libs << 'test'
11
- t.pattern = 'test/**/*_test.rb'
8
+ t.libs = ['lib','test']
9
+ t.test_files = Dir.glob("test/**/*_test.rb").sort
12
10
  t.verbose = true
13
11
  end
14
12
 
13
+ task :default => [:test]
@@ -1,3 +1,4 @@
1
+ require 'active_record'
1
2
  require 'active_record/version'
2
3
  require 'grouped_scope/errors'
3
4
  require 'grouped_scope/self_grouping'
@@ -22,14 +22,14 @@ module GroupedScope
22
22
  model.send(ungrouped_reflection.macro, grouped_name, grouped_options).tap do |grouped_reflection|
23
23
  grouped_reflection.grouped_scope = true
24
24
  model.grouped_reflections = model.grouped_reflections.merge(ungrouped_name => grouped_reflection)
25
- define_grouped_scope_reader(model)
25
+ define_grouped_scope_reader
26
26
  end
27
27
  end
28
28
 
29
29
 
30
30
  private
31
31
 
32
- def define_grouped_scope_reader(model)
32
+ def define_grouped_scope_reader
33
33
  model.send(:define_method, :group) do
34
34
  @group ||= GroupedScope::SelfGroupping.new(self)
35
35
  end
@@ -5,16 +5,12 @@ module GroupedScope
5
5
 
6
6
  extend ActiveSupport::Concern
7
7
 
8
- module InstanceMethods
9
-
10
- def association_scope
11
- if reflection.grouped_scope?
12
- @association_scope ||= Associations::AssociationScope.new(self).scope if klass
13
- else
14
- super
15
- end
8
+ def association_scope
9
+ if reflection.grouped_scope?
10
+ @association_scope ||= Associations::AssociationScope.new(self).scope if klass
11
+ else
12
+ super
16
13
  end
17
-
18
14
  end
19
15
 
20
16
  end
@@ -1,3 +1,3 @@
1
1
  module GroupedScope
2
- VERSION = '3.1.1'
2
+ VERSION = '3.1.2'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
3
  require "bundler/setup"
4
- Bundler.require(:default, :development, :test)
4
+ Bundler.require
5
5
  require 'grouped_scope'
6
6
  require 'minitest/autorun'
7
7
  require 'factories'
@@ -156,7 +156,7 @@ class Employee < ActiveRecord::Base
156
156
  end
157
157
 
158
158
  class LegacyEmployee < ActiveRecord::Base
159
- set_primary_key :email
159
+ self.primary_key = 'email'
160
160
  has_many :reports, :class_name => 'LegacyReport', :foreign_key => 'email'
161
161
  grouped_scope :reports
162
162
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grouped_scope
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 1
10
- version: 3.1.1
9
+ - 2
10
+ version: 3.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ken Collins
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-12-07 00:00:00 Z
18
+ date: 2012-01-02 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activerecord
@@ -25,15 +25,93 @@ dependencies:
25
25
  requirements:
26
26
  - - ~>
27
27
  - !ruby/object:Gem::Version
28
- hash: 3
28
+ hash: 5
29
29
  segments:
30
30
  - 3
31
31
  - 1
32
- - 0
33
- version: 3.1.0
32
+ version: "3.1"
34
33
  type: :runtime
35
34
  version_requirements: *id001
36
- description: Extends has_many associations to group scope. For ActiveRecord 3.1!
35
+ - !ruby/object:Gem::Dependency
36
+ name: sqlite3
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ hash: 9
44
+ segments:
45
+ - 1
46
+ - 3
47
+ version: "1.3"
48
+ type: :development
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: rake
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ hash: 63
59
+ segments:
60
+ - 0
61
+ - 9
62
+ - 2
63
+ version: 0.9.2
64
+ type: :development
65
+ version_requirements: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ name: minitest
68
+ prerelease: false
69
+ requirement: &id004 !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ hash: 45
75
+ segments:
76
+ - 2
77
+ - 8
78
+ - 1
79
+ version: 2.8.1
80
+ type: :development
81
+ version_requirements: *id004
82
+ - !ruby/object:Gem::Dependency
83
+ name: factory_girl
84
+ prerelease: false
85
+ requirement: &id005 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ hash: 7
91
+ segments:
92
+ - 2
93
+ - 3
94
+ - 2
95
+ version: 2.3.2
96
+ type: :development
97
+ version_requirements: *id005
98
+ - !ruby/object:Gem::Dependency
99
+ name: mocha
100
+ prerelease: false
101
+ requirement: &id006 !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ~>
105
+ - !ruby/object:Gem::Version
106
+ hash: 55
107
+ segments:
108
+ - 0
109
+ - 10
110
+ - 0
111
+ version: 0.10.0
112
+ type: :development
113
+ version_requirements: *id006
114
+ description: Extends has_many associations to group scope. For ActiveRecord!
37
115
  email:
38
116
  - ken@metaskills.net
39
117
  executables: []
@@ -47,6 +125,8 @@ files:
47
125
  - .travis.yml
48
126
  - CHANGELOG
49
127
  - Gemfile
128
+ - Gemfile.rails-3.1
129
+ - Gemfile.rails-3.2
50
130
  - MIT-LICENSE
51
131
  - README.md
52
132
  - Rakefile
@@ -96,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
176
  requirements: []
97
177
 
98
178
  rubyforge_project:
99
- rubygems_version: 1.8.11
179
+ rubygems_version: 1.8.12
100
180
  signing_key:
101
181
  specification_version: 3
102
182
  summary: Extends has_many associations to group scope.