cm-admin 2.1.2 → 2.1.3

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: 0bf108bd43b406a281c6ed12ad91abf98ac9c9036b65016e0290f439f6a3f4fe
4
- data.tar.gz: 9a6ef986cf196dc7ed52479a0f5e7f325d6c51ff0b2442fed231cc39be8cae63
3
+ metadata.gz: c68983444fcc76457f2f9c67844a6518d39a6e1a9f4656d5e869188d517ae1b7
4
+ data.tar.gz: 6dda9b94f136c52dba561e65b31db92b4a2b9036f078d2d1aaf66d1c972a49ea
5
5
  SHA512:
6
- metadata.gz: 94e62aeebf8d5554baee3efc5535cb9b63347d6de55f8a725a03f639da53db436bbba6674aa693dbb9f93a9fc69dae23bcc3e751c8adce507045115bccc9f58f
7
- data.tar.gz: 56875e172f79dd906e4ce20f78c7621ebd4f696b7f5c582003db2e33f37ba043a3c99fbd3d14c230f5e3b8a1171ee13610fc934e40d452ac5773e17e6043d90f
6
+ metadata.gz: 3fb734f37af1c3a6204c6b5e6aa04530410cafd8f1bb208457ae84bbf452a1b2811154acab9a7b330bfad42d7ded483f9c58c7a0f51a5c490ca7ad77a7ce5679
7
+ data.tar.gz: 3e27a73e792d282d2d8f334716c7a56692ed3f11af67eddcbccfe529f8fc117833d6aee191673b3cf44edc4af5b768d8ce3b03264e4ac366cf5560f6a348b9ed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cm-admin (2.1.2)
4
+ cm-admin (2.1.3)
5
5
  caxlsx_rails
6
6
  cocoon (~> 1.2.15)
7
7
  csv-importer (~> 0.8.2)
@@ -1,23 +1,22 @@
1
1
  class CmPermission < ApplicationRecord
2
-
3
2
  after_create :create_hidden_permission
4
3
  after_destroy :destroy_hidden_permission
5
4
 
6
- validates :action_name, presence: true, uniqueness: {scope: :ar_model_name}
5
+ validates :action_name, presence: true, uniqueness: { scope: %i[ar_model_name cm_role_id] }
7
6
 
8
7
  def create_hidden_permission
9
8
  if action_name == 'new'
10
- CmPermission.where(action_name: 'create', ar_model_name: ar_model_name, cm_role_id: cm_role_id).first_or_create
9
+ CmPermission.where(action_name: 'create', ar_model_name:, cm_role_id:).first_or_create
11
10
  elsif action_name == 'edit'
12
- CmPermission.where(action_name: 'update', ar_model_name: ar_model_name, cm_role_id: cm_role_id).first_or_create
11
+ CmPermission.where(action_name: 'update', ar_model_name:, cm_role_id:).first_or_create
13
12
  end
14
13
  end
15
14
 
16
15
  def destroy_hidden_permission
17
16
  if action_name == 'new'
18
- CmPermission.where(action_name: 'create', ar_model_name: ar_model_name, cm_role_id: cm_role_id).first&.destroy
17
+ CmPermission.where(action_name: 'create', ar_model_name:, cm_role_id:).first&.destroy
19
18
  elsif action_name == 'edit'
20
- CmPermission.where(action_name: 'update', ar_model_name: ar_model_name, cm_role_id: cm_role_id).first&.destroy
19
+ CmPermission.where(action_name: 'update', ar_model_name:, cm_role_id:).first&.destroy
21
20
  end
22
21
  end
23
22
  end
@@ -1,3 +1,3 @@
1
1
  module CmAdmin
2
- VERSION = '2.1.2'
2
+ VERSION = '2.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cm-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael