bullet_train-super_scaffolding 1.12.2 → 1.12.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: be0df510fd098c114487239ac00e69b54856df38cef8655d61316f8119c1d9ce
4
- data.tar.gz: 0aec8526362652c9003780d54cd2245e5b137ececb2d162997588517f37e51c8
3
+ metadata.gz: c84cb4d581618c07a651084cff60e510bf4df6bfa78bcbc6b7e3125aab92f1ba
4
+ data.tar.gz: bff2ba24ff94b0516a4ca36ad4836a87d1f5bfef5b00dfa5192da4f0128d6b63
5
5
  SHA512:
6
- metadata.gz: 87e04a49f198d65ea4c71f67641b59c68387a61dfd064cf30ac42cfa3f987f612ca5bd9db5d0569f407f4d177b1a12c52f0e0e5b74a7d4042165dba526d011b5
7
- data.tar.gz: 313288579b1ccb287d0026c65d77d11da4b24527321719ddfb6f046b553ecd7b293666e140a1f0598a00e817c9eb848045091e835119eb6295fd67bdda7e1246
6
+ metadata.gz: 61eca18fb9787f8a22313c8749effd04f629bac711ebfff419f43043b1228f9d325a88cc192885d5bc01f80e53ee7224347ed961c4b6584b22a2d119ae7d5f81
7
+ data.tar.gz: 22b0efedb45e2cf68b2751609647e5c49a89a71624788baf31b9d3f3406edbe111cc1afb2deb5877a226a3eb04c2f4b407143666de92f2351b3f026153189246
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module SuperScaffolding
3
- VERSION = "1.12.2"
3
+ VERSION = "1.12.3"
4
4
  end
5
5
  end
@@ -327,7 +327,19 @@ class Scaffolding::Transformer
327
327
 
328
328
  if target_file_content.include?(transformed_content) && !content_matches_model_name
329
329
  puts "No need to update '#{transformed_file_name}'. It already has '#{transformed_content}'." unless silence_logs?
330
-
330
+ elsif !target_file_content.include?(transform_hook)
331
+ unless options[:suppress_could_not_find_hook]
332
+ puts
333
+ puts "-------------------------------".yellow
334
+ puts "Heads up! We weren't able to find a super scaffolding hook where we expected it to be.".yellow
335
+ puts "In #{transformed_file_name}".yellow
336
+ puts "We expected to find a line like this:".yellow
337
+ puts transform_hook.yellow
338
+ puts
339
+ puts "See https://bullettrain.co/docs/super-scaffolding/targets for more details.".yellow
340
+ puts "-------------------------------".yellow
341
+ puts
342
+ end
331
343
  else
332
344
 
333
345
  new_target_file_content = []
@@ -967,10 +979,16 @@ class Scaffolding::Transformer
967
979
  "./app/controllers/account/scaffolding/completely_concrete/tangible_things_controller.rb",
968
980
  "./app/controllers/api/v1/scaffolding/completely_concrete/tangible_things_controller.rb"
969
981
  ].each do |file|
982
+ # We usually do StrongParams stuff in the API controller and the Account controller inherits it from there.
983
+ # We _used_ to do StrongParams stuff directly in the Account controller. So for backwards compatibility we
984
+ # need to try to make updates in the Account controller, but if we can't find the target hook there's no need
985
+ # to show an error and make the developer think that they've broken something.
986
+ suppress_could_not_find_hook = file.match("/account/")
987
+
970
988
  if attribute.is_ids? || attribute.is_multiple?
971
- scaffold_add_line_to_file(file, "#{attribute.name}: [],", RUBY_NEW_ARRAYS_HOOK, prepend: true)
989
+ scaffold_add_line_to_file(file, "#{attribute.name}: [],", RUBY_NEW_ARRAYS_HOOK, prepend: true, suppress_could_not_find_hook: suppress_could_not_find_hook)
972
990
  if attribute.file_field? || attribute.active_storage_image?
973
- scaffold_add_line_to_file(file, "#{attribute.name}_removal: [],", RUBY_NEW_ARRAYS_HOOK, prepend: true)
991
+ scaffold_add_line_to_file(file, "#{attribute.name}_removal: [],", RUBY_NEW_ARRAYS_HOOK, prepend: true, suppress_could_not_find_hook: suppress_could_not_find_hook)
974
992
  end
975
993
  elsif attribute.type == "address_field"
976
994
  address_strong_params = <<~RUBY
@@ -985,11 +1003,11 @@ class Scaffolding::Transformer
985
1003
  :postal_code
986
1004
  ],
987
1005
  RUBY
988
- scaffold_add_line_to_file(file, address_strong_params, RUBY_NEW_ARRAYS_HOOK, prepend: true)
1006
+ scaffold_add_line_to_file(file, address_strong_params, RUBY_NEW_ARRAYS_HOOK, prepend: true, suppress_could_not_find_hook: suppress_could_not_find_hook)
989
1007
  else
990
- scaffold_add_line_to_file(file, ":#{attribute.name},", RUBY_NEW_FIELDS_HOOK, prepend: true)
1008
+ scaffold_add_line_to_file(file, ":#{attribute.name},", RUBY_NEW_FIELDS_HOOK, prepend: true, suppress_could_not_find_hook: suppress_could_not_find_hook)
991
1009
  if attribute.file_field? || attribute.active_storage_image?
992
- scaffold_add_line_to_file(file, ":#{attribute.name}_removal,", RUBY_NEW_FIELDS_HOOK, prepend: true)
1010
+ scaffold_add_line_to_file(file, ":#{attribute.name}_removal,", RUBY_NEW_FIELDS_HOOK, prepend: true, suppress_could_not_find_hook: suppress_could_not_find_hook)
993
1011
  end
994
1012
  end
995
1013
  end
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.12.2
4
+ version: 1.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-18 00:00:00.000000000 Z
11
+ date: 2024-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard