bullet_train-super_scaffolding 1.2.11 → 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: 175742fbb3b9512721c4250562fc533f6c43cf630f3c277345d59d61538a3364
4
- data.tar.gz: 83933564920e87dc260767af664fcba01894f1484d76ed93c8288742705071f1
3
+ metadata.gz: a298ab4bf4e4ef34b72728d13025076979ce8a53ed014b12c88103922b724b42
4
+ data.tar.gz: 673d9792c5134c97faff3625581e39d2250a703ccfab7b21ad28d004f0790350
5
5
  SHA512:
6
- metadata.gz: 5e9a5613d412175f70bd8cdedd9a2aa91cee42a96fefdf0b16ec5862276ef09f0f0f664062b0968d197a5a1b986b7b7f25e154422736f1c3fd5d4026cafe1784
7
- data.tar.gz: 1d004de2a792cdd6d0d39f65842aa5ef161c4018d681beb5579737c1191b95411bcea4b2adeeb3561c14b34b69b389bcf8dc01025d2f6612b96d6f300445871a
6
+ metadata.gz: 26045ef5529ee5792c835ad924bb029782d13338ddfc1b2f40f350595e7d9099a0dca2a5f21f62944eda315c236a73ffda53bf1f67d13f8fbc1b80f23f4f50ba
7
+ data.tar.gz: b9c3c2e11675220b19e0104fcfc5345dad1f21f6efb3affd90247b335a04d17995b1d4cf8ee0ef6b5ba76e79ec3a088a372c50e910607ae98bbbd69786194eb3
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module SuperScaffolding
3
- VERSION = "1.2.11"
3
+ VERSION = "1.2.12"
4
4
  end
5
5
  end
@@ -498,9 +498,20 @@ class Scaffolding::Transformer
498
498
  def add_ability_line_to_roles_yml(class_names = nil)
499
499
  model_names = class_names || [child]
500
500
  role_file = "./config/models/roles.yml"
501
+ roles_hash = YAML.load_file(role_file)
502
+ default_role_placements = [
503
+ [:default, :models],
504
+ [:admin, :models]
505
+ ]
506
+
501
507
  model_names.each do |model_name|
502
- Scaffolding::FileManipulator.add_line_to_yml_file(role_file, "#{model_name}: read", [:default, :models])
503
- Scaffolding::FileManipulator.add_line_to_yml_file(role_file, "#{model_name}: manage", [:admin, :models])
508
+ default_role_placements.each do |role_placement|
509
+ stringified_role_placement = role_placement.map { |placement| placement.to_s }
510
+ if roles_hash.dig(*stringified_role_placement)[model_name].nil?
511
+ role_type = (role_placement.first == :admin) ? "manage" : "read"
512
+ Scaffolding::FileManipulator.add_line_to_yml_file(role_file, "#{model_name}: #{role_type}", role_placement)
513
+ end
514
+ end
504
515
  end
505
516
  end
506
517
 
@@ -711,6 +722,8 @@ class Scaffolding::Transformer
711
722
  "text"
712
723
  when "text_area"
713
724
  "text"
725
+ when "number_field"
726
+ "number"
714
727
  when "file_field"
715
728
  "file"
716
729
  when "password_field"
data/lib/scaffolding.rb CHANGED
@@ -16,6 +16,7 @@ module Scaffolding
16
16
  "email_field",
17
17
  "emoji_field",
18
18
  "file_field",
19
+ "number_field",
19
20
  "options",
20
21
  "password_field",
21
22
  "phone_field",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train-super_scaffolding
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.11
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: 2023-02-15 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: standard