bullet_train-roles 0.1.5 → 0.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51bbbee558714e45bdff2dadf3735cf8a2fce88d7e7e3a8144880c245bb8e384
4
- data.tar.gz: 419402bc1f7560bc932c202275091456e4a68ddd271ddf7382df57b7f4b21b1f
3
+ metadata.gz: 93fd2729ae287aa0389216798de23663aa3703bed3f5f11e571371c4b55bd30a
4
+ data.tar.gz: e094e75bec9daf0073e1d658dd0113b4743dfb7a138cf2f2e4eb34851ef85d23
5
5
  SHA512:
6
- metadata.gz: 30bfee959c7c45e7dda23c7d4f71fa44a1efc9499e3bd5244e48e55895ff88e21fc26ade42def3591661c0aef1796762edae9a05625b1145822c5eb3a71cfc43
7
- data.tar.gz: 6da43045a530531c8910f4c456f7c5b7211ac90f9cce69d05fc7a7456fedb664d099a951d0c5fdd131f4daa8f0784ac36add7837bfcc7760ff5193c22191c21c
6
+ metadata.gz: 5a905f35fd471b0dfd2e82355f0ede399ac7d212825509ca180732392418d6af9d5821ae46808c85b183e89515f0aacd029142e1d3f9b23ea1e360a0c754fce9
7
+ data.tar.gz: 2cbcb69b7244c96854ae4841978ded8b7466e04c13a534de8819e35fd28a65b38c03e28f5dbdad9e039bfff5630702196d691f3e1b64490bab464c433d69e982
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- bullet_train-roles (0.1.4)
12
+ bullet_train-roles (0.1.6)
13
13
  active_hash
14
14
  activesupport
15
15
  cancancan
@@ -106,6 +106,8 @@ GEM
106
106
  nio4r (2.5.8)
107
107
  nokogiri (1.12.5-arm64-darwin)
108
108
  racc (~> 1.4)
109
+ nokogiri (1.12.5-x86_64-darwin)
110
+ racc (~> 1.4)
109
111
  parallel (1.21.0)
110
112
  parser (3.0.3.2)
111
113
  ast (~> 2.4.1)
@@ -174,6 +176,7 @@ GEM
174
176
  PLATFORMS
175
177
  arm64-darwin-20
176
178
  arm64-darwin-21
179
+ x86_64-darwin-21
177
180
 
178
181
  DEPENDENCIES
179
182
  active_hash!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Roles
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.6"
5
5
  end
data/lib/models/role.rb CHANGED
@@ -172,7 +172,9 @@ class Role < ActiveYaml::Base
172
172
  # If possible, use the team_id attribute because it saves us having to join all the way back to the sorce parent model
173
173
  # In some scenarios this may be quicker, or if the parent model is in a different database shard, it may not even
174
174
  # be possible to do the join
175
- if @model.method_defined?("#{parent_association}_id")
175
+ # using method_defined? will break with ActiveRecord 7 because now models have team_id defined if they include
176
+ # has_one :team, through: :membership
177
+ if @model.column_names.include?("#{parent_association}_id")
176
178
  @condition = {"#{parent_association}_id".to_sym => @parent_ids}
177
179
  else
178
180
  @condition = {parent_association => {id: @parent_ids}}
data/lib/roles/support.rb CHANGED
@@ -71,7 +71,7 @@ module Roles
71
71
  end
72
72
 
73
73
  def roles=(roles)
74
- self.role_ids = roles.map(&:key)
74
+ self.update(role_ids: roles.map(&:key))
75
75
  end
76
76
 
77
77
  def assignable_roles
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-roles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prabin Poudel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-02-11 00:00:00.000000000 Z
12
+ date: 2022-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: byebug
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  - !ruby/object:Gem::Version
216
216
  version: '0'
217
217
  requirements: []
218
- rubygems_version: 3.2.22
218
+ rubygems_version: 3.3.0
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: Yaml-backed ApplicationHash for CanCan Roles