bullet_train-super_load_and_authorize_resource 1.2.10 → 1.2.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85bbd6c03d039f10d676167ac2cc2cfa7e576b39a3ef892b89cc6d7d086ba23d
4
- data.tar.gz: 913268a6c376b32399c8ab1567984db7042785495e51e66be73bc0a060009ae0
3
+ metadata.gz: 3f95fb12178132e2b2c64b5a52432d05f7403be57086e915bca1c3fe4fafc220
4
+ data.tar.gz: 5b9dd64e1a09d5a461254184a3198201349a05e4f6392832c4408524d886dd99
5
5
  SHA512:
6
- metadata.gz: c16871e4a815174d91dd7b4aceae608ab38a7fde881b650cb780b9204ceb18d57786c1234fe5e2188564a2cefd705949c9d07fef347b9bbf4be60e92d42b5dd2
7
- data.tar.gz: 0f823117e2c303b271ecd26f72720534ebc28d345aefe6c53170d9222fce900687c67ae1e9ab7d2952e03a251aac69145aa69621583025924a8d4b6d86b61440
6
+ metadata.gz: 7e985c7987e0c25b59c62fc24a42d16a8632afafa88dc405685ed177b5e2d51e71c44db937af05b398545cc9d7a42b3f5a0d0ee54a77e560c7d190b32ad301de
7
+ data.tar.gz: 480353d8d9491bdf84d8759b26ae99c8fe80f551638110393ecf42bafa359e8606eea3054fc270ace0d225389aca599aab540bff6e73d0d6ad0a5a3f8cc50660
@@ -7,8 +7,14 @@ module LoadsAndAuthorizesResource
7
7
  end
8
8
 
9
9
  def load_team
10
- # Sometimes `@team` has already been populated by earlier `before_action` steps.
11
- @team ||= @child_object&.team || @parent_object&.team
10
+ # Not all objects that need to be authorized belong to a team,
11
+ # so we give @team a nil value if no association is found.
12
+ begin
13
+ # Sometimes `@team` has already been populated by earlier `before_action` steps.
14
+ @team ||= @child_object&.team || @parent_object&.team
15
+ rescue NoMethodError
16
+ @team = nil
17
+ end
12
18
 
13
19
  # Update current attributes.
14
20
  Current.team = @team
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module SuperLoadAndAuthorizeResource
3
- VERSION = "1.2.10"
3
+ VERSION = "1.2.12"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-super_load_and_authorize_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.10
4
+ version: 1.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-31 00:00:00.000000000 Z
11
+ date: 2023-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails