edge_rider 0.3.3 → 1.0.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.
- checksums.yaml +7 -0
- data/.travis.yml +28 -31
- data/CHANGELOG.md +18 -0
- data/{gemfiles/Gemfile.3.2.mysql2 → Gemfile.3.2.mysql2} +1 -1
- data/{gemfiles/Gemfile.3.2.mysql2.lock → Gemfile.3.2.mysql2.lock} +3 -3
- data/{gemfiles/Gemfile.4.2.mysql2 → Gemfile.4.2.mysql2} +1 -1
- data/{gemfiles/Gemfile.4.2.mysql2.lock → Gemfile.4.2.mysql2.lock} +3 -3
- data/{gemfiles/Gemfile.4.2.pg → Gemfile.4.2.pg} +1 -1
- data/{gemfiles/Gemfile.4.2.pg.lock → Gemfile.4.2.pg.lock} +3 -3
- data/{gemfiles/Gemfile.5.1.mysql2 → Gemfile.5.2.mysql2} +3 -2
- data/{gemfiles/Gemfile.5.1.mysql2.lock → Gemfile.5.2.mysql2.lock} +19 -17
- data/Gemfile.5.2.pg +16 -0
- data/{gemfiles/Gemfile.5.1.pg.lock → Gemfile.5.2.pg.lock} +19 -17
- data/{gemfiles/Gemfile.5.1.pg → Gemfile.6.0.pg} +2 -2
- data/Gemfile.6.0.pg.lock +64 -0
- data/README.md +21 -42
- data/Rakefile +1 -1
- data/lib/edge_rider.rb +0 -1
- data/lib/edge_rider/collect_column.rb +8 -15
- data/lib/edge_rider/origin_class.rb +2 -10
- data/lib/edge_rider/scoped.rb +1 -1
- data/lib/edge_rider/to_id_query.rb +1 -1
- data/lib/edge_rider/traverse_association.rb +2 -2
- data/lib/edge_rider/util.rb +8 -15
- data/lib/edge_rider/version.rb +1 -1
- data/spec/edge_rider/collect_column_spec.rb +21 -21
- data/spec/edge_rider/collect_ids_spec.rb +16 -16
- data/spec/edge_rider/origin_class_spec.rb +9 -9
- data/spec/edge_rider/preload_associations_spec.rb +3 -3
- data/spec/edge_rider/scoped_spec.rb +17 -19
- data/spec/edge_rider/to_id_query_spec.rb +12 -12
- data/spec/edge_rider/traverse_association_spec.rb +47 -53
- data/spec/support/database.rb +1 -1
- data/spec/support/models.rb +14 -18
- metadata +46 -69
- data/gemfiles/Gemfile.2.3.mysql2 +0 -16
- data/gemfiles/Gemfile.2.3.mysql2.lock +0 -37
- data/lib/edge_rider/to_sql.rb +0 -13
- data/spec/edge_rider/to_sql_spec.rb +0 -14
@@ -5,25 +5,25 @@ describe EdgeRider::OriginClass do
|
|
5
5
|
describe '#origin_class' do
|
6
6
|
|
7
7
|
it "should return the class a scope is based on" do
|
8
|
-
Forum.create!(:
|
9
|
-
Forum.create!(:
|
10
|
-
scope = Forum.scoped(:
|
8
|
+
Forum.create!(id: 1)
|
9
|
+
Forum.create!(id: 2)
|
10
|
+
scope = Forum.scoped(conditions: { id: [1] })
|
11
11
|
scope.origin_class.should == Forum
|
12
12
|
scope.origin_class.collect_ids.should == [1, 2]
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should return the class a scope chain is based on" do
|
16
|
-
Forum.create!(:
|
17
|
-
Forum.create!(:
|
18
|
-
Forum.create!(:
|
19
|
-
scope_chain = Forum.scoped(:
|
16
|
+
Forum.create!(id: 1, name: 'A')
|
17
|
+
Forum.create!(id: 2, name: 'B')
|
18
|
+
Forum.create!(id: 3, name: 'C')
|
19
|
+
scope_chain = Forum.scoped(conditions: { id: [1, 2] }).scoped(conditions: { name: ['A', 'B'] })
|
20
20
|
scope_chain.origin_class.should == Forum
|
21
21
|
scope_chain.origin_class.collect_ids.should == [1, 2, 3]
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should return itself when called on an ActiveRecord class" do
|
25
|
-
Forum.create!(:
|
26
|
-
Forum.create!(:
|
25
|
+
Forum.create!(id: 1)
|
26
|
+
Forum.create!(id: 2)
|
27
27
|
Forum.origin_class.should == Forum
|
28
28
|
Forum.origin_class.collect_ids.should == [1, 2]
|
29
29
|
end
|
@@ -4,9 +4,9 @@ describe EdgeRider::PreloadAssociations do
|
|
4
4
|
|
5
5
|
it 'should preload the given named associations so they are no longer fetched lazily' do
|
6
6
|
forum = Forum.create!
|
7
|
-
topic = Topic.create!(:
|
8
|
-
post = Post.create!(:
|
9
|
-
Forum.preload_associations([forum], :
|
7
|
+
topic = Topic.create!(forum: forum)
|
8
|
+
post = Post.create!(topic: topic)
|
9
|
+
Forum.preload_associations([forum], topics: :posts)
|
10
10
|
Topic.should_not_receive(:new)
|
11
11
|
Post.should_not_receive(:new)
|
12
12
|
forum.topics.collect(&:posts)
|
@@ -4,9 +4,7 @@ describe EdgeRider::Scoped do
|
|
4
4
|
describe 'scoped' do
|
5
5
|
|
6
6
|
it 'returns a scope when called without parameters' do
|
7
|
-
|
8
|
-
EdgeRider::Util.scope?( Forum.scoped ).should == true
|
9
|
-
end
|
7
|
+
EdgeRider::Util.scope?( Forum.scoped ).should == true
|
10
8
|
end
|
11
9
|
|
12
10
|
it 'returns a scope when called with an empty hash' do
|
@@ -14,41 +12,41 @@ describe EdgeRider::Scoped do
|
|
14
12
|
end
|
15
13
|
|
16
14
|
it 'respects conditions' do
|
17
|
-
trashed = Forum.create! :
|
18
|
-
active = Forum.create! :
|
15
|
+
trashed = Forum.create! trashed: true
|
16
|
+
active = Forum.create! trashed: false
|
19
17
|
|
20
|
-
Forum.scoped(:
|
18
|
+
Forum.scoped(conditions: { trashed: true }).to_a.should == [ trashed ]
|
21
19
|
end
|
22
20
|
|
23
21
|
it 'respects order' do
|
24
|
-
c = Forum.create! :
|
25
|
-
a = Forum.create! :
|
26
|
-
b = Forum.create! :
|
22
|
+
c = Forum.create! name: 'Chemikalien'
|
23
|
+
a = Forum.create! name: 'Allegorie'
|
24
|
+
b = Forum.create! name: 'Botanisch'
|
27
25
|
|
28
|
-
Forum.scoped(:
|
26
|
+
Forum.scoped(order: 'name ASC').to_a.should == [ a, b, c ]
|
29
27
|
end
|
30
28
|
|
31
29
|
it 'can be used to add conditions to an existing scope chain' do
|
32
|
-
bulldog = Forum.create! :
|
33
|
-
trashed = Forum.create! :
|
34
|
-
trashed_bulldog = Forum.create! :
|
30
|
+
bulldog = Forum.create! name: 'bulldog', trashed: false
|
31
|
+
trashed = Forum.create! name: 'maneuver', trashed: true
|
32
|
+
trashed_bulldog = Forum.create! name: 'bulldog', trashed: true
|
35
33
|
|
36
34
|
Forum.
|
37
|
-
scoped(:
|
38
|
-
scoped(:
|
35
|
+
scoped(conditions: { trashed: true }).
|
36
|
+
scoped(conditions: { name: 'bulldog' }).to_a.should == [ trashed_bulldog ]
|
39
37
|
end
|
40
38
|
|
41
39
|
it 'can be used to add conditions to a has_many association' do
|
42
40
|
forum = Forum.create!
|
43
|
-
thema = Topic.create! :
|
44
|
-
other_topic = Topic.create! :
|
45
|
-
trashed_thema = Topic.create! :
|
41
|
+
thema = Topic.create! subject: 'Thema', trashed: false, forum: forum
|
42
|
+
other_topic = Topic.create! subject: 'Other', trashed: false, forum: forum
|
43
|
+
trashed_thema = Topic.create! subject: 'Thema', trashed: true, forum: forum
|
46
44
|
|
47
45
|
has_many_scope = forum.active_topics
|
48
46
|
# In Rails 3, #scoped on associations does not take parameters but turns
|
49
47
|
# an association into a real scope.
|
50
48
|
has_many_scope = has_many_scope.scoped if ActiveRecord::VERSION::MAJOR == 3
|
51
|
-
has_many_scope.scoped(:
|
49
|
+
has_many_scope.scoped(conditions: { subject: 'Thema' }).to_a.should =~ [ thema ]
|
52
50
|
end
|
53
51
|
|
54
52
|
end
|
@@ -5,22 +5,22 @@ describe EdgeRider::ToIdQuery do
|
|
5
5
|
describe '#to_id_query' do
|
6
6
|
|
7
7
|
it 'should simplify a scope to a IN query that selects IDs' do
|
8
|
-
Forum.create!(:
|
9
|
-
Forum.create!(:
|
10
|
-
Forum.create!(:
|
11
|
-
scope = Forum.scoped(:
|
8
|
+
Forum.create!(id: 1, name: 'Name 1')
|
9
|
+
Forum.create!(id: 2, name: 'Name 2')
|
10
|
+
Forum.create!(id: 3, name: 'Name 2')
|
11
|
+
scope = Forum.scoped(conditions: { name: 'Name 2' })
|
12
12
|
scope.to_id_query.to_sql.should =~ EdgeRider::Development.selects_star_with_conditions_pattern('forums', /["`]?forums["`]?\.["`]?id["`]? IN \(2,\s*3\)/)
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should resolve and lose any JOINs' do
|
16
|
-
Forum.create!(:
|
17
|
-
Forum.create!(:
|
18
|
-
Forum.create!(:
|
19
|
-
Topic.create!(:
|
20
|
-
Topic.create!(:
|
21
|
-
Topic.create!(:
|
22
|
-
Topic.create!(:
|
23
|
-
scope = Topic.scoped(:
|
16
|
+
Forum.create!(id: 1, name: 'A')
|
17
|
+
Forum.create!(id: 2, name: 'B')
|
18
|
+
Forum.create!(id: 3, name: 'A')
|
19
|
+
Topic.create!(id: 100, forum_id: 1)
|
20
|
+
Topic.create!(id: 101, forum_id: 1)
|
21
|
+
Topic.create!(id: 102, forum_id: 2)
|
22
|
+
Topic.create!(id: 103, forum_id: 3)
|
23
|
+
scope = Topic.scoped(joins: :forum, conditions: "forums.name = 'A'")
|
24
24
|
scope.to_id_query.to_sql.should =~ EdgeRider::Development.selects_star_with_conditions_pattern('topics', /["`]?topics["`]?\.["`]?id["`]? IN \(100,\s*101,\s*103\)/)
|
25
25
|
end
|
26
26
|
|
@@ -8,37 +8,35 @@ describe EdgeRider::TraverseAssociation do
|
|
8
8
|
forum_1 = Forum.create!
|
9
9
|
forum_2 = Forum.create!
|
10
10
|
forum_3 = Forum.create!
|
11
|
-
topic_1 = Topic.create!(:
|
12
|
-
topic_2 = Topic.create!(:
|
13
|
-
topic_3 = Topic.create!(:
|
14
|
-
topic_4 = Topic.create!(:
|
15
|
-
scope = Topic.scoped(:
|
11
|
+
topic_1 = Topic.create!(forum: forum_1)
|
12
|
+
topic_2 = Topic.create!(forum: forum_1)
|
13
|
+
topic_3 = Topic.create!(forum: forum_2)
|
14
|
+
topic_4 = Topic.create!(forum: forum_3)
|
15
|
+
scope = Topic.scoped(conditions: { id: [ topic_2.id, topic_4.id ] })
|
16
16
|
traversed_scope = scope.traverse_association(:forum)
|
17
17
|
EdgeRider::Util.scope?(traversed_scope).should == true
|
18
18
|
traversed_scope.to_a.should =~ [forum_1, forum_3]
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should raise an error when traversing a belongs_to association with conditions, until this is implemented' do
|
22
|
-
forum = Forum.create!(:
|
23
|
-
topic = Topic.create(:
|
22
|
+
forum = Forum.create!(trashed: true)
|
23
|
+
topic = Topic.create(forum: forum)
|
24
24
|
|
25
|
-
scope = Topic.scoped(:
|
25
|
+
scope = Topic.scoped(conditions: { id: topic.id })
|
26
26
|
expect { scope.traverse_association(:active_forum) }.to raise_error(NotImplementedError)
|
27
27
|
end
|
28
28
|
|
29
|
-
it 'should traverse a belongs_to association with conditions'
|
30
|
-
|
31
29
|
it 'should traverse multiple belongs_to associations in different model classes' do
|
32
30
|
forum_1 = Forum.create!
|
33
31
|
forum_2 = Forum.create!
|
34
32
|
forum_3 = Forum.create!
|
35
|
-
topic_1 = Topic.create!(:
|
36
|
-
topic_2 = Topic.create!(:
|
37
|
-
topic_3 = Topic.create!(:
|
38
|
-
post_1 = Post.create!(:
|
39
|
-
post_2 = Post.create!(:
|
40
|
-
post_3 = Post.create!(:
|
41
|
-
scope = Post.scoped(:
|
33
|
+
topic_1 = Topic.create!(forum: forum_1)
|
34
|
+
topic_2 = Topic.create!(forum: forum_2)
|
35
|
+
topic_3 = Topic.create!(forum: forum_3)
|
36
|
+
post_1 = Post.create!(topic: topic_1)
|
37
|
+
post_2 = Post.create!(topic: topic_2)
|
38
|
+
post_3 = Post.create!(topic: topic_3)
|
39
|
+
scope = Post.scoped(conditions: { id: [post_1.id, post_3.id] })
|
42
40
|
traversed_scope = scope.traverse_association(:topic, :forum)
|
43
41
|
EdgeRider::Util.scope?(traversed_scope).should == true
|
44
42
|
traversed_scope.to_a.should =~ [forum_1, forum_3]
|
@@ -48,14 +46,14 @@ describe EdgeRider::TraverseAssociation do
|
|
48
46
|
forum_1 = Forum.create!
|
49
47
|
forum_2 = Forum.create!
|
50
48
|
forum_3 = Forum.create!
|
51
|
-
topic_1 = Topic.create!(:
|
52
|
-
topic_2 = Topic.create!(:
|
53
|
-
topic_3 = Topic.create!(:
|
54
|
-
post_1 = Post.create!(:
|
55
|
-
post_2 = Post.create!(:
|
56
|
-
post_3a = Post.create!(:
|
57
|
-
post_3b = Post.create!(:
|
58
|
-
scope = Forum.scoped(:
|
49
|
+
topic_1 = Topic.create!(forum: forum_1)
|
50
|
+
topic_2 = Topic.create!(forum: forum_2)
|
51
|
+
topic_3 = Topic.create!(forum: forum_3)
|
52
|
+
post_1 = Post.create!(topic: topic_1)
|
53
|
+
post_2 = Post.create!(topic: topic_2)
|
54
|
+
post_3a = Post.create!(topic: topic_3)
|
55
|
+
post_3b = Post.create!(topic: topic_3)
|
56
|
+
scope = Forum.scoped(conditions: { id: [forum_1.id, forum_3.id] })
|
59
57
|
traversed_scope = scope.traverse_association(:topics, :posts)
|
60
58
|
EdgeRider::Util.scope?(traversed_scope).should == true
|
61
59
|
traversed_scope.to_a.should =~ [post_1, post_3a, post_3b]
|
@@ -64,26 +62,24 @@ describe EdgeRider::TraverseAssociation do
|
|
64
62
|
# in Rails 4, conditions on a scope are expressed as a lambda parameter
|
65
63
|
it 'should raise an error when traversing a has_many association with conditions, until this is implemented' do
|
66
64
|
forum = Forum.create!
|
67
|
-
topic = Topic.create(:
|
65
|
+
topic = Topic.create(forum: forum, trashed: true)
|
68
66
|
|
69
|
-
scope = Forum.scoped(:
|
67
|
+
scope = Forum.scoped(conditions: { id: forum.id })
|
70
68
|
expect { scope.traverse_association(:active_topics) }.to raise_error(NotImplementedError)
|
71
69
|
end
|
72
70
|
|
73
|
-
it 'should traverse a has_many association with conditions'
|
74
|
-
|
75
71
|
it 'should traverse a has_many :through association' do
|
76
72
|
forum_1 = Forum.create!
|
77
73
|
forum_2 = Forum.create!
|
78
74
|
forum_3 = Forum.create!
|
79
|
-
topic_1 = Topic.create!(:
|
80
|
-
topic_2 = Topic.create!(:
|
81
|
-
topic_3 = Topic.create!(:
|
82
|
-
post_1 = Post.create!(:
|
83
|
-
post_2 = Post.create!(:
|
84
|
-
post_3a = Post.create!(:
|
85
|
-
post_3b = Post.create!(:
|
86
|
-
scope = Forum.scoped(:
|
75
|
+
topic_1 = Topic.create!(forum: forum_1)
|
76
|
+
topic_2 = Topic.create!(forum: forum_2)
|
77
|
+
topic_3 = Topic.create!(forum: forum_3)
|
78
|
+
post_1 = Post.create!(topic: topic_1)
|
79
|
+
post_2 = Post.create!(topic: topic_2)
|
80
|
+
post_3a = Post.create!(topic: topic_3)
|
81
|
+
post_3b = Post.create!(topic: topic_3)
|
82
|
+
scope = Forum.scoped(conditions: { id: [forum_1.id, forum_3.id] })
|
87
83
|
traversed_scope = scope.traverse_association(:posts)
|
88
84
|
EdgeRider::Util.scope?(traversed_scope).should == true
|
89
85
|
traversed_scope.to_a.should =~ [post_1, post_3a, post_3b]
|
@@ -93,10 +89,10 @@ describe EdgeRider::TraverseAssociation do
|
|
93
89
|
user_1 = User.create!
|
94
90
|
user_2 = User.create!
|
95
91
|
user_3 = User.create!
|
96
|
-
profile_1 = Profile.create!(:
|
97
|
-
profile_2 = Profile.create!(:
|
98
|
-
profile_3 = Profile.create!(:
|
99
|
-
scope = User.scoped(:
|
92
|
+
profile_1 = Profile.create!(user: user_1)
|
93
|
+
profile_2 = Profile.create!(user: user_2)
|
94
|
+
profile_3 = Profile.create!(user: user_3)
|
95
|
+
scope = User.scoped(conditions: { id: [user_2.id, user_3.id] })
|
100
96
|
traversed_scope = scope.traverse_association(:profile)
|
101
97
|
EdgeRider::Util.scope?(traversed_scope).should == true
|
102
98
|
traversed_scope.to_a.should =~ [profile_2, profile_3]
|
@@ -104,26 +100,24 @@ describe EdgeRider::TraverseAssociation do
|
|
104
100
|
|
105
101
|
it 'should raise an error when traversing a has_many association with conditions, until this is implemented' do
|
106
102
|
user = User.create!
|
107
|
-
profile = Profile.create(:
|
103
|
+
profile = Profile.create(user: user, trashed: true)
|
108
104
|
|
109
|
-
scope = User.scoped(:
|
105
|
+
scope = User.scoped(conditions: { id: user.id })
|
110
106
|
expect { scope.traverse_association(:active_profile) }.to raise_error(NotImplementedError)
|
111
107
|
end
|
112
108
|
|
113
|
-
it 'should traverse a has_one association with conditions'
|
114
|
-
|
115
109
|
it 'should traverse up and down the same edges' do
|
116
110
|
forum_1 = Forum.create!
|
117
111
|
forum_2 = Forum.create!
|
118
112
|
forum_3 = Forum.create!
|
119
|
-
topic_1 = Topic.create!(:
|
120
|
-
topic_2 = Topic.create!(:
|
121
|
-
topic_3 = Topic.create!(:
|
122
|
-
post_1 = Post.create!(:
|
123
|
-
post_2 = Post.create!(:
|
124
|
-
post_3a = Post.create!(:
|
125
|
-
post_3b = Post.create!(:
|
126
|
-
scope = Post.scoped(:
|
113
|
+
topic_1 = Topic.create!(forum: forum_1)
|
114
|
+
topic_2 = Topic.create!(forum: forum_2)
|
115
|
+
topic_3 = Topic.create!(forum: forum_3)
|
116
|
+
post_1 = Post.create!(topic: topic_1)
|
117
|
+
post_2 = Post.create!(topic: topic_2)
|
118
|
+
post_3a = Post.create!(topic: topic_3)
|
119
|
+
post_3b = Post.create!(topic: topic_3)
|
120
|
+
scope = Post.scoped(conditions: { id: [post_3a.id] })
|
127
121
|
traversed_scope = scope.traverse_association(:topic, :forum, :topics, :posts)
|
128
122
|
EdgeRider::Util.scope?(traversed_scope).should == true
|
129
123
|
traversed_scope.to_a.should =~ [post_3a, post_3b]
|
data/spec/support/database.rb
CHANGED
data/spec/support/models.rb
CHANGED
@@ -13,11 +13,7 @@ module AllowSettingIdOnCreate
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.included(base)
|
16
|
-
|
17
|
-
base.send(:include, RemoveIdFromProtectedAttributes)
|
18
|
-
else # Rails 3 has this as a class method
|
19
|
-
base.send(:extend, RemoveIdFromProtectedAttributes)
|
20
|
-
end
|
16
|
+
base.send(:extend, RemoveIdFromProtectedAttributes)
|
21
17
|
end
|
22
18
|
|
23
19
|
end
|
@@ -29,11 +25,11 @@ class Forum < ActiveRecord::Base
|
|
29
25
|
include AllowSettingIdOnCreate
|
30
26
|
|
31
27
|
has_many :topics
|
32
|
-
has_many :posts, :
|
28
|
+
has_many :posts, through: :topics
|
33
29
|
EdgeRider::Util.define_association self, :has_many, :active_topics,
|
34
|
-
:
|
30
|
+
conditions: { trashed: false }, class_name: 'Topic'
|
35
31
|
|
36
|
-
has_defaults :
|
32
|
+
has_defaults trashed: false
|
37
33
|
|
38
34
|
end
|
39
35
|
|
@@ -42,11 +38,11 @@ class Post < ActiveRecord::Base
|
|
42
38
|
include AllowSettingIdOnCreate
|
43
39
|
|
44
40
|
belongs_to :topic
|
45
|
-
belongs_to :author, :
|
41
|
+
belongs_to :author, class_name: 'User'
|
46
42
|
|
47
|
-
has_defaults :
|
43
|
+
has_defaults trashed: false
|
48
44
|
|
49
|
-
EdgeRider::Util.define_scope self, :these, lambda { |array| { :
|
45
|
+
EdgeRider::Util.define_scope self, :these, lambda { |array| { conditions: { id: array } } }
|
50
46
|
|
51
47
|
end
|
52
48
|
|
@@ -56,7 +52,7 @@ class Profile < ActiveRecord::Base
|
|
56
52
|
|
57
53
|
belongs_to :user
|
58
54
|
|
59
|
-
has_defaults :
|
55
|
+
has_defaults trashed: false
|
60
56
|
|
61
57
|
end
|
62
58
|
|
@@ -66,13 +62,13 @@ class Topic < ActiveRecord::Base
|
|
66
62
|
|
67
63
|
belongs_to :forum
|
68
64
|
EdgeRider::Util.define_association self, :belongs_to, :active_forum,
|
69
|
-
:
|
65
|
+
conditions: { trashed: false }, class_name: 'Forum'
|
70
66
|
|
71
67
|
has_many :posts
|
72
|
-
belongs_to :author, :
|
73
|
-
has_many :post_authors, :
|
68
|
+
belongs_to :author, class_name: 'User'
|
69
|
+
has_many :post_authors, through: :posts
|
74
70
|
|
75
|
-
has_defaults :
|
71
|
+
has_defaults trashed: false
|
76
72
|
|
77
73
|
end
|
78
74
|
|
@@ -85,8 +81,8 @@ class User < ActiveRecord::Base
|
|
85
81
|
|
86
82
|
has_one :profile
|
87
83
|
EdgeRider::Util.define_association self, :has_one, :active_profile,
|
88
|
-
:
|
84
|
+
conditions: { trashed: false }, class_name: 'Profile'
|
89
85
|
|
90
|
-
has_defaults :
|
86
|
+
has_defaults trashed: false
|
91
87
|
|
92
88
|
end
|
metadata
CHANGED
@@ -1,65 +1,55 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: edge_rider
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 3
|
10
|
-
version: 0.3.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Henning Koch
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2019-06-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: activerecord
|
22
|
-
|
23
|
-
|
24
|
-
none: false
|
25
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
26
17
|
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
32
20
|
type: :runtime
|
33
|
-
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
34
27
|
description: Power tools for ActiveRecord relations (scopes)
|
35
28
|
email: henning.koch@makandra.de
|
36
29
|
executables: []
|
37
|
-
|
38
30
|
extensions: []
|
39
|
-
|
40
31
|
extra_rdoc_files: []
|
41
|
-
|
42
|
-
|
43
|
-
- .
|
44
|
-
- .
|
45
|
-
- .travis.yml
|
32
|
+
files:
|
33
|
+
- ".gitignore"
|
34
|
+
- ".ruby-version"
|
35
|
+
- ".travis.yml"
|
46
36
|
- CHANGELOG.md
|
37
|
+
- Gemfile.3.2.mysql2
|
38
|
+
- Gemfile.3.2.mysql2.lock
|
39
|
+
- Gemfile.4.2.mysql2
|
40
|
+
- Gemfile.4.2.mysql2.lock
|
41
|
+
- Gemfile.4.2.pg
|
42
|
+
- Gemfile.4.2.pg.lock
|
43
|
+
- Gemfile.5.2.mysql2
|
44
|
+
- Gemfile.5.2.mysql2.lock
|
45
|
+
- Gemfile.5.2.pg
|
46
|
+
- Gemfile.5.2.pg.lock
|
47
|
+
- Gemfile.6.0.pg
|
48
|
+
- Gemfile.6.0.pg.lock
|
47
49
|
- LICENSE
|
48
50
|
- README.md
|
49
51
|
- Rakefile
|
50
52
|
- edge_rider.gemspec
|
51
|
-
- gemfiles/Gemfile.2.3.mysql2
|
52
|
-
- gemfiles/Gemfile.2.3.mysql2.lock
|
53
|
-
- gemfiles/Gemfile.3.2.mysql2
|
54
|
-
- gemfiles/Gemfile.3.2.mysql2.lock
|
55
|
-
- gemfiles/Gemfile.4.2.mysql2
|
56
|
-
- gemfiles/Gemfile.4.2.mysql2.lock
|
57
|
-
- gemfiles/Gemfile.4.2.pg
|
58
|
-
- gemfiles/Gemfile.4.2.pg.lock
|
59
|
-
- gemfiles/Gemfile.5.1.mysql2
|
60
|
-
- gemfiles/Gemfile.5.1.mysql2.lock
|
61
|
-
- gemfiles/Gemfile.5.1.pg
|
62
|
-
- gemfiles/Gemfile.5.1.pg.lock
|
63
53
|
- lib/edge_rider.rb
|
64
54
|
- lib/edge_rider/collect_column.rb
|
65
55
|
- lib/edge_rider/collect_ids.rb
|
@@ -68,7 +58,6 @@ files:
|
|
68
58
|
- lib/edge_rider/preload_associations.rb
|
69
59
|
- lib/edge_rider/scoped.rb
|
70
60
|
- lib/edge_rider/to_id_query.rb
|
71
|
-
- lib/edge_rider/to_sql.rb
|
72
61
|
- lib/edge_rider/traverse_association.rb
|
73
62
|
- lib/edge_rider/util.rb
|
74
63
|
- lib/edge_rider/version.rb
|
@@ -78,7 +67,6 @@ files:
|
|
78
67
|
- spec/edge_rider/preload_associations_spec.rb
|
79
68
|
- spec/edge_rider/scoped_spec.rb
|
80
69
|
- spec/edge_rider/to_id_query_spec.rb
|
81
|
-
- spec/edge_rider/to_sql_spec.rb
|
82
70
|
- spec/edge_rider/traverse_association_spec.rb
|
83
71
|
- spec/edge_rider/util_spec.rb
|
84
72
|
- spec/spec_helper.rb
|
@@ -87,38 +75,27 @@ files:
|
|
87
75
|
- spec/support/database.travis.yml
|
88
76
|
- spec/support/models.rb
|
89
77
|
homepage: https://github.com/makandra/edge_rider
|
90
|
-
licenses:
|
78
|
+
licenses:
|
91
79
|
- MIT
|
80
|
+
metadata: {}
|
92
81
|
post_install_message:
|
93
82
|
rdoc_options: []
|
94
|
-
|
95
|
-
require_paths:
|
83
|
+
require_paths:
|
96
84
|
- lib
|
97
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
-
|
99
|
-
requirements:
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
100
87
|
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
version: "0"
|
106
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
|
-
requirements:
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
109
92
|
- - ">="
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
|
112
|
-
segments:
|
113
|
-
- 0
|
114
|
-
version: "0"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
115
95
|
requirements: []
|
116
|
-
|
117
96
|
rubyforge_project:
|
118
|
-
rubygems_version:
|
97
|
+
rubygems_version: 2.4.5.1
|
119
98
|
signing_key:
|
120
|
-
specification_version:
|
99
|
+
specification_version: 4
|
121
100
|
summary: Power tools for ActiveRecord relations (scopes)
|
122
101
|
test_files: []
|
123
|
-
|
124
|
-
has_rdoc:
|