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.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +104 -0
  3. data/.rspec +1 -0
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +29 -5
  6. data/Gemfile +1 -0
  7. data/Gemfile.4.2.mysql2 +4 -2
  8. data/Gemfile.4.2.mysql2.lock +35 -21
  9. data/Gemfile.4.2.pg +3 -1
  10. data/Gemfile.4.2.pg.lock +33 -19
  11. data/Gemfile.5.2.mysql2 +4 -2
  12. data/Gemfile.5.2.mysql2.lock +21 -7
  13. data/Gemfile.5.2.pg +3 -1
  14. data/Gemfile.5.2.pg.lock +19 -5
  15. data/{Gemfile.6.0.pg → Gemfile.6.1.pg} +4 -2
  16. data/Gemfile.6.1.pg.lock +82 -0
  17. data/{Gemfile.3.2.mysql2 → Gemfile.7.0.pg} +7 -6
  18. data/Gemfile.7.0.pg.lock +78 -0
  19. data/Gemfile.lock +1 -0
  20. data/README.md +86 -60
  21. data/edge_rider.gemspec +25 -15
  22. data/lib/edge_rider/preload_associations.rb +15 -13
  23. data/lib/edge_rider/traverse_association.rb +7 -3
  24. data/lib/edge_rider/util.rb +1 -1
  25. data/lib/edge_rider/version.rb +1 -1
  26. metadata +19 -28
  27. data/.travis.yml +0 -63
  28. data/Gemfile.3.2.mysql2.lock +0 -62
  29. data/Gemfile.6.0.pg.lock +0 -64
  30. data/spec/edge_rider/collect_column_spec.rb +0 -85
  31. data/spec/edge_rider/collect_ids_spec.rb +0 -108
  32. data/spec/edge_rider/origin_class_spec.rb +0 -32
  33. data/spec/edge_rider/preload_associations_spec.rb +0 -15
  34. data/spec/edge_rider/scoped_spec.rb +0 -53
  35. data/spec/edge_rider/to_id_query_spec.rb +0 -29
  36. data/spec/edge_rider/traverse_association_spec.rb +0 -128
  37. data/spec/edge_rider/util_spec.rb +0 -5
  38. data/spec/spec_helper.rb +0 -12
  39. data/spec/support/database.rb +0 -34
  40. data/spec/support/database.sample.yml +0 -10
  41. data/spec/support/database.travis.yml +0 -9
  42. data/spec/support/models.rb +0 -88
@@ -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