brick 1.0.201 → 1.0.203

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: 52b363a56451567ff44ebee4510f850eb6f1df3d09bf05392c75a3c0444daa73
4
- data.tar.gz: bd39b40ba7fbeae5f9225ba8a9591f53082f60ee6f89f68b9bc83199656c75fd
3
+ metadata.gz: 7653a7b2f496e0ade8937b6352b66d06a63dc47487a2472ebf5e5f5b94faf711
4
+ data.tar.gz: b4723c7d202d7cdaf125bd0ca6bc52852b89c813444bf8e4662724a591d7a7bc
5
5
  SHA512:
6
- metadata.gz: e095c942770c458142026d918aa7084853d23963c0802dbda7a7773b504cc2a6a751369cbf58214453aa83e004230b8bab9ff7c2d1040bffc9f28a5b371c894e
7
- data.tar.gz: 4d15b729fea0b416cf75fc18a6ce11c28eea989438d831de94710d8878ee9cb2174df7a5075028922691acceea9af2322591f4219b8dbca16b7a25716c55ee09
6
+ metadata.gz: c29614452bbbd5b1c52e6fcee20fd2308479e508a03d15d98ddd3ca73c3ad746dff9e9bfffb8979768f456d68ce5bbfaa286d96c2ef62c65e306bd3d0fa15495
7
+ data.tar.gz: f8a2ac34c8a34a3a7308a49b6e17a57bf71c13718a58838f61e8e5d45699f3d9dee766a3786d4fd11be52601f02e9168803f49a8b4ce35ef7d404bef95523584
@@ -1508,7 +1508,7 @@ module Brick
1508
1508
  ::Brick::ADD_AVO_FIELDS.call(self, model)
1509
1509
  end
1510
1510
  end
1511
- ::Avo::BaseResource.const_set(requested.to_sym, built_resource)
1511
+ ::Avo::Resources.const_set(requested.to_sym, built_resource)
1512
1512
  built_resource
1513
1513
  end
1514
1514
  end
@@ -225,14 +225,6 @@ function linkSchemas() {
225
225
  # Specific database tables and views to omit when auto-creating models
226
226
  ::Brick.exclude_tables = app.config.brick.fetch(:exclude_tables, [])
227
227
 
228
- # Class for auto-generated models to inherit from
229
- ::Brick.models_inherit_from = app.config.brick.fetch(:models_inherit_from, nil) ||
230
- begin
231
- ::ApplicationRecord
232
- rescue StandardError => ex
233
- ::ActiveRecord::Base
234
- end
235
-
236
228
  # When table names have specific prefixes, automatically place them in their own module with a table_name_prefix.
237
229
  ::Brick.config.table_name_prefixes ||= app.config.brick.fetch(:table_name_prefixes, {})
238
230
 
@@ -340,8 +332,8 @@ function linkSchemas() {
340
332
  end
341
333
  end
342
334
  end
343
- else # Avo 2.x
344
- (self::App.respond_to?(:eager_load) ? App : DynamicRouter).class_exec do
335
+ elsif self::App.respond_to?(:eager_load) # Avo 2.x (compatible with 2.20.0 and up)
336
+ App.class_exec do
345
337
  class << self
346
338
  alias _brick_eager_load eager_load
347
339
  def eager_load(entity)
@@ -368,7 +360,10 @@ function linkSchemas() {
368
360
  if is_2x # Avo 2.x?
369
361
  "::#{class_name}Resource".constantize
370
362
  else # Avo 3.x
371
- ::Brick.avo_3x_resource(Object.const_get(class_name), class_name) unless ::Avo::BaseResource.constants.include?(class_name.to_sym)
363
+ unless ::Avo::BaseResource.constants.include?(class_name.to_sym) ||
364
+ ::Avo::Resources.constants.include?(class_name.to_sym)
365
+ ::Brick.avo_3x_resource(Object.const_get(class_name), class_name)
366
+ end
372
367
  end
373
368
  end
374
369
  end
@@ -426,12 +421,14 @@ window.addEventListener(\"popstate\", linkSchemas);
426
421
  end
427
422
 
428
423
  class Fields::IndexComponent
429
- alias _brick_resource_view_path resource_view_path
430
- def resource_view_path
431
- mdl_class = @resource.respond_to?(:model_class) ? @resource.model_class : @resource.model&.class
432
- return if mdl_class&.is_view?
424
+ if respond_to?(:resource_view_path)
425
+ alias _brick_resource_view_path resource_view_path
426
+ def resource_view_path
427
+ mdl_class = @resource.respond_to?(:model_class) ? @resource.model_class : @resource.model&.class
428
+ return if mdl_class&.is_view?
433
429
 
434
- _brick_resource_view_path
430
+ _brick_resource_view_path
431
+ end
435
432
  end
436
433
  end
437
434
 
@@ -630,7 +627,7 @@ window.addEventListener(\"popstate\", linkSchemas);
630
627
  alias :_brick_lookup_context :lookup_context
631
628
  def lookup_context(*args)
632
629
  ret = _brick_lookup_context(*args)
633
- @_lookup_context.instance_variable_set(:@_brick_req_params, params) if request
630
+ @_lookup_context.instance_variable_set(:@_brick_req_params, params) if self.class < AbstractController::Base && params
634
631
  ret
635
632
  end
636
633
  end
@@ -1656,10 +1653,8 @@ end
1656
1653
  # path_options = [obj.#{pk}]
1657
1654
  # path_options << { '_brick_schema': } if
1658
1655
  options = {}
1659
- if ::Brick.config.path_prefix || (obj.class.table_name.singularize == obj.class.table_name)
1660
- path_helper = obj.new_record? ? #{model_name}._brick_index : #{model_name}._brick_index(:singular)
1661
- options[:url] = send(\"#\{path_helper}_path\".to_sym, obj)
1662
- end
1656
+ path_helper = obj.new_record? ? #{model_name}._brick_index : #{model_name}._brick_index(:singular)
1657
+ options[:url] = send(\"#\{path_helper}_path\".to_sym, obj) if ::Brick.config.path_prefix || (path_helper != obj.class.table_name)
1663
1658
  %>
1664
1659
  <br><br>
1665
1660
 
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 201
8
+ TINY = 203
9
9
 
10
10
  # PRE is nil unless it's a pre-release (beta, RC, etc.)
11
11
  PRE = nil
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.201
4
+ version: 1.0.203
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorin Thwaits
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-03 00:00:00.000000000 Z
11
+ date: 2024-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord