edge_rider 1.0.0 → 2.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.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +104 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +29 -5
- data/Gemfile +1 -0
- data/Gemfile.4.2.mysql2 +4 -2
- data/Gemfile.4.2.mysql2.lock +35 -21
- data/Gemfile.4.2.pg +3 -1
- data/Gemfile.4.2.pg.lock +33 -19
- data/Gemfile.5.2.mysql2 +4 -2
- data/Gemfile.5.2.mysql2.lock +21 -7
- data/Gemfile.5.2.pg +3 -1
- data/Gemfile.5.2.pg.lock +19 -5
- data/{Gemfile.6.0.pg → Gemfile.6.1.pg} +4 -2
- data/Gemfile.6.1.pg.lock +82 -0
- data/{Gemfile.3.2.mysql2 → Gemfile.7.0.pg} +7 -6
- data/Gemfile.7.0.pg.lock +78 -0
- data/Gemfile.lock +1 -0
- data/README.md +86 -60
- data/edge_rider.gemspec +25 -15
- data/lib/edge_rider/preload_associations.rb +15 -13
- data/lib/edge_rider/traverse_association.rb +7 -3
- data/lib/edge_rider/util.rb +1 -1
- data/lib/edge_rider/version.rb +1 -1
- metadata +19 -28
- data/.travis.yml +0 -63
- data/Gemfile.3.2.mysql2.lock +0 -62
- data/Gemfile.6.0.pg.lock +0 -64
- data/spec/edge_rider/collect_column_spec.rb +0 -85
- data/spec/edge_rider/collect_ids_spec.rb +0 -108
- data/spec/edge_rider/origin_class_spec.rb +0 -32
- data/spec/edge_rider/preload_associations_spec.rb +0 -15
- data/spec/edge_rider/scoped_spec.rb +0 -53
- data/spec/edge_rider/to_id_query_spec.rb +0 -29
- data/spec/edge_rider/traverse_association_spec.rb +0 -128
- data/spec/edge_rider/util_spec.rb +0 -5
- data/spec/spec_helper.rb +0 -12
- data/spec/support/database.rb +0 -34
- data/spec/support/database.sample.yml +0 -10
- data/spec/support/database.travis.yml +0 -9
- data/spec/support/models.rb +0 -88
data/spec/support/models.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
require 'has_defaults'
|
2
|
-
|
3
|
-
# Since our specs are mostly about working with IDs, this module can be
|
4
|
-
# included in an ActiveRecord model class to allow setting the :id attribute
|
5
|
-
# on create. This is forbidden by default.
|
6
|
-
# http://stackoverflow.com/questions/431617/overriding-id-on-create-in-activerecord
|
7
|
-
module AllowSettingIdOnCreate
|
8
|
-
|
9
|
-
module RemoveIdFromProtectedAttributes
|
10
|
-
def attributes_protected_by_default
|
11
|
-
super - ['id']
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.included(base)
|
16
|
-
base.send(:extend, RemoveIdFromProtectedAttributes)
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
class Forum < ActiveRecord::Base
|
25
|
-
include AllowSettingIdOnCreate
|
26
|
-
|
27
|
-
has_many :topics
|
28
|
-
has_many :posts, through: :topics
|
29
|
-
EdgeRider::Util.define_association self, :has_many, :active_topics,
|
30
|
-
conditions: { trashed: false }, class_name: 'Topic'
|
31
|
-
|
32
|
-
has_defaults trashed: false
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
|
37
|
-
class Post < ActiveRecord::Base
|
38
|
-
include AllowSettingIdOnCreate
|
39
|
-
|
40
|
-
belongs_to :topic
|
41
|
-
belongs_to :author, class_name: 'User'
|
42
|
-
|
43
|
-
has_defaults trashed: false
|
44
|
-
|
45
|
-
EdgeRider::Util.define_scope self, :these, lambda { |array| { conditions: { id: array } } }
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
class Profile < ActiveRecord::Base
|
51
|
-
include AllowSettingIdOnCreate
|
52
|
-
|
53
|
-
belongs_to :user
|
54
|
-
|
55
|
-
has_defaults trashed: false
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
class Topic < ActiveRecord::Base
|
61
|
-
include AllowSettingIdOnCreate
|
62
|
-
|
63
|
-
belongs_to :forum
|
64
|
-
EdgeRider::Util.define_association self, :belongs_to, :active_forum,
|
65
|
-
conditions: { trashed: false }, class_name: 'Forum'
|
66
|
-
|
67
|
-
has_many :posts
|
68
|
-
belongs_to :author, class_name: 'User'
|
69
|
-
has_many :post_authors, through: :posts
|
70
|
-
|
71
|
-
has_defaults trashed: false
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
class User < ActiveRecord::Base
|
77
|
-
include AllowSettingIdOnCreate
|
78
|
-
|
79
|
-
has_many :posts
|
80
|
-
has_many :topics
|
81
|
-
|
82
|
-
has_one :profile
|
83
|
-
EdgeRider::Util.define_association self, :has_one, :active_profile,
|
84
|
-
conditions: { trashed: false }, class_name: 'Profile'
|
85
|
-
|
86
|
-
has_defaults trashed: false
|
87
|
-
|
88
|
-
end
|