brick 1.0.226 → 1.0.228

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: f49b4376a0265094ca854c558df6bc4166a619de70bb8b8306cee5667b3545fa
4
- data.tar.gz: 2230e3a409329ec8781aa92e976f4dca318727a1620b3814d1f382ef9e33502c
3
+ metadata.gz: ada376a5ef8d35110b7228a583cdcb18e5246fcfa52b975aff872c9a2ac7e37d
4
+ data.tar.gz: 7621c881fcacca08f8b9543371fbcb190c0513e5d8c8b6bc2c767a51a48ef43e
5
5
  SHA512:
6
- metadata.gz: bd980b9c153b10d7b9298299553d552c1265b61cbd842fdd4814d6188a27dc101366fff42bf52cfa799f4a6304bb71e5b9505742b3fe606c41eef5309bd6d2e7
7
- data.tar.gz: b196a9a308e512f1faaea85982c6a738fe7bb00b70ef2d9e7eeff37638b01ca563696d85e1e82216b1358c2999cb9bfaf7e4081f012121c0266ebf8ff2f877d9
6
+ metadata.gz: 8ccbeae9b7cf7874653de1666af8a708e77126248eadec4cd80d1766f33063f93a7b198aabdb02895e9a8456d89b63f36a15d6348a70a9b9ead928b7a29c1567
7
+ data.tar.gz: 7fc00087943b2b7fdab18783793057772f59a1e98896239a8cc4c4d91f7aa41201265931393201a399c3b3261186a7e56deb4d8703cb46676eafd5a10ab3fa22
@@ -1497,7 +1497,7 @@ end
1497
1497
  # ... then just fall through and allow it to fail when trying to load the ____Controller class normally.
1498
1498
  end
1499
1499
  unless skip_controller
1500
- Object.send(:build_controller, self, class_name, plural_class_name, model, relations)
1500
+ Object.send(:build_controller, self, class_name, plural_class_name, model, relations, is_brick_prefix)
1501
1501
  end
1502
1502
 
1503
1503
  # MODULE
@@ -2096,7 +2096,7 @@ class Object
2096
2096
  end
2097
2097
  end
2098
2098
 
2099
- def build_controller(namespace, class_name, plural_class_name, model, relations)
2099
+ def build_controller(namespace, class_name, plural_class_name, model, relations, is_brick_prefix = nil)
2100
2100
  if (is_avo = (namespace.name == 'Avo' && Object.const_defined?('Avo')))
2101
2101
  # Basic Avo functionality is available via its own generic controller.
2102
2102
  # (More information on https://docs.avohq.io/3.0/controllers.html)
@@ -2278,7 +2278,11 @@ class Object
2278
2278
  end
2279
2279
 
2280
2280
  self.protect_from_forgery unless: -> { self.request.format.js? }
2281
- tn_start = (pcn_split = plural_class_name.split('::')).length > 1 ? -2 : -1
2281
+ pcn_split = [plural_class_name]
2282
+ namespace_names = namespace&.name&.split('::')
2283
+ namespace_names&.shift if is_brick_prefix
2284
+ pcn_split.unshift(namespace_names.join('::')) if namespace_names.present?
2285
+ tn_start = pcn_split.length > 1 ? -2 : -1
2282
2286
  plural_table_name = pcn_split[tn_start..-1].join.underscore.pluralize
2283
2287
  singular_table_name = plural_table_name.singularize
2284
2288
  unless is_avo
@@ -587,8 +587,9 @@ window.addEventListener(\"popstate\", linkSchemas);
587
587
  def lookup_context(*args)
588
588
  ret = _brick_lookup_context(*args)
589
589
  if self.class < AbstractController::Base
590
- request if respond_to?(:request) # ActionMailer does not have +request+
591
- @_lookup_context.instance_variable_set(:@_brick_req_params, params) if request && params.present?
590
+ if respond_to?(:request) # ActionMailer does not have +request+
591
+ @_lookup_context.instance_variable_set(:@_brick_req_params, params) if request && params.present?
592
+ end
592
593
  end
593
594
  ret
594
595
  end
@@ -681,7 +682,7 @@ window.addEventListener(\"popstate\", linkSchemas);
681
682
  rescue StandardError => e
682
683
  # Search through the routes to confirm that something might match (Devise stuff for instance, which has its own view templates),
683
684
  # and bubble the same exception (probably an ActionView::MissingTemplate) if a legitimate option is found.
684
- raise if ActionView.version >= ::Gem::Version.new('5.0') &&
685
+ raise if ActionView.version >= ::Gem::Version.new('5.0') && args[1] &&
685
686
  ::Rails.application.routes.set.find { |x| args[1].include?(x.defaults[:controller]) && args[0] == x.defaults[:action] }
686
687
 
687
688
  find_template_err = e
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 226
8
+ TINY = 228
9
9
 
10
10
  # PRE is nil unless it's a pre-release (beta, RC, etc.)
11
11
  PRE = nil
@@ -63,8 +63,8 @@ module Brick
63
63
  else
64
64
  Object
65
65
  end
66
- controller_parts[controller_parts.length - 1] = (controller_name = "#{controller_parts.last}Controller")
67
- _built_controller, code = Object.send(:build_controller, namespace, controller_name, controller_name, controller_option.model, relations)
66
+ _built_controller, code = Object.send(:build_controller, namespace, (controller_name = "#{controller_parts.last}Controller"), controller_parts.last, controller_option.model, relations)
67
+ controller_parts[-1] = controller_name
68
68
  path = ['controllers']
69
69
  path.concat(controller_parts.map(&:underscore))
70
70
  dir = +"#{::Rails.root}/app"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brick
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.226
4
+ version: 1.0.228
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorin Thwaits
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-09 00:00:00.000000000 Z
11
+ date: 2025-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord