brick 1.0.176 → 1.0.178

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: 281b8aaa57a588877d66c995c0c0ec718a73c6b1cfdfc733bed25df2e7bdea8b
4
- data.tar.gz: f314b8580a2a45f501f8f64f23f35225571cc299f96d1cc89c6da7ecf55de523
3
+ metadata.gz: 888b7144102e5155a28f931b7b986a68a3eb781dee890990fae9f81ed8bf2e21
4
+ data.tar.gz: c5fcc9dd02f6b45025d600e9a02a16011e93559568c63c24b4acde0f603a2540
5
5
  SHA512:
6
- metadata.gz: 0ad317de582d86e0b67fc4396fa3b1dab9a018fa101b7bd3265157783ebb714a936b8593086d9a749dfc54654009dc921c0f4c32476a2bcee29138a281ecb03b
7
- data.tar.gz: 117990ba8e3d7a8d3dea3e7f2394ab063b6d30b224cb96b70f6c758945fb062ce398249a4107767e78088251e444c55fbd71f1df8bd0ee73a77de40574661041
6
+ metadata.gz: f8f32f40106be993ee33bac87ef4dad4558e7bcbae61f6f61658671b825eba6312586f75fdc329c22a3a2898a2d38e568c70e05ca173e9824637226ce28aaee3
7
+ data.tar.gz: e3e0fa0646201059751ecf8fdd30860d582aa3e746ceeb3c6cac276aa831dcefe6a9fc8de34f6e4a720fcd5503842192e8cd8f33ceed37cb6087000d342223ee
@@ -1553,9 +1553,13 @@ class Object
1553
1553
  end))
1554
1554
  end
1555
1555
  hmts = nil
1556
+ if (schema_module || Object).const_defined?((chosen_name = (inheritable_name || model_name)).to_sym)
1557
+ possible = (schema_module || Object).const_get(chosen_name)
1558
+ return possible unless possible == schema_module
1559
+ end
1556
1560
  code = +"class #{full_name} < #{base_model.name}\n"
1557
1561
  built_model = Class.new(base_model) do |new_model_class|
1558
- (schema_module || Object).const_set((chosen_name = (inheritable_name || model_name)).to_sym, new_model_class)
1562
+ (schema_module || Object).const_set(chosen_name, new_model_class)
1559
1563
  @_brick_relation = relation
1560
1564
  if inheritable_name
1561
1565
  new_model_class.define_singleton_method :inherited do |subclass|
@@ -3100,7 +3104,8 @@ module Brick
3100
3104
  missing << fk[1] unless relations.key?(fk[1])
3101
3105
  missing << primary_table unless is_class || relations.key?(primary_table)
3102
3106
  unless missing.empty?
3103
- tables = relations.reject { |_k, v| v.fetch(:isView, nil) }.keys.sort
3107
+ tables = relations.reject { |_k, v| v.is_a?(Hash) && v.fetch(:isView, nil) }.keys
3108
+ .select { |table_name| table_name.is_a?(String) }.sort
3104
3109
  puts "Brick: Additional reference #{fk.inspect} refers to non-existent #{'table'.pluralize(missing.length)} #{missing.join(' and ')}. (Available tables include #{tables.join(', ')}.)"
3105
3110
  return
3106
3111
  end
@@ -1489,7 +1489,8 @@ end
1489
1489
  decipher = OpenSSL::Cipher::AES256.new(:CBC).decrypt
1490
1490
  decipher.iv = "\xB4,\r2\x19\xF5\xFE/\aR\x1A\x8A\xCFV\v\x8C"
1491
1491
  decipher.key = Digest::SHA256.hexdigest(::Brick.config.license).scan(/../).map { |x| x.hex }.pack('c*')
1492
- decipher.update(File.binread("/Users/aga/brick/lib/brick/frameworks/rails/crosstab.brk"))[16..-1]
1492
+ brick_path = Gem::Specification.find_by_name('brick').gem_dir
1493
+ decipher.update(File.binread("#{brick_path}/lib/brick/frameworks/rails/crosstab.brk"))[16..-1]
1493
1494
  else
1494
1495
  'Crosstab Charting not yet activated -- enter a valid license key in brick.rb'
1495
1496
  end
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 176
8
+ TINY = 178
9
9
 
10
10
  # PRE is nil unless it's a pre-release (beta, RC, etc.)
11
11
  PRE = nil
data/lib/brick.rb CHANGED
@@ -89,7 +89,7 @@ end
89
89
  # is first established), and then automatically creates models, controllers, views,
90
90
  # and routes based on those available relations.
91
91
  require 'brick/config'
92
- if Gem::Specification.all_names.any? { |g| g.start_with?('rails-') && g[6..-1] =~ /^([0-9]|\.)+$/ }
92
+ if Gem::Specification.all_names.any? { |g| g.start_with?('rails-') && g[6..-1] =~ /^([0-9]|\.)+(?:|rc1|rc2|beta1)$/ }
93
93
  require 'rails'
94
94
  require 'brick/frameworks/rails'
95
95
  end
@@ -2026,6 +2026,28 @@ if ActiveRecord.version < ::Gem::Version.new('6.0') && ruby_version >= ::Gem::Ve
2026
2026
  end
2027
2027
  end
2028
2028
 
2029
+ # AR >= 5.0 on Ruby >= 3.0
2030
+ ::ActiveRecord::Type::AdapterSpecificRegistry.class_exec do
2031
+ alias :_brick_add_modifier :add_modifier
2032
+ def add_modifier(*args, **kwargs)
2033
+ kwargs.merge!(args.pop) if args.length > 2 && args.last.is_a?(Hash)
2034
+ _brick_add_modifier(*args, **kwargs)
2035
+ end
2036
+ end
2037
+
2038
+ # AR >= 5.0 on Ruby >= 3.0
2039
+ arca = ::ActiveRecord::ConnectionAdapters
2040
+ require 'active_record/connection_adapters/postgresql/column'
2041
+ if arca.const_defined?('PostgreSQLColumn')
2042
+ arca::PostgreSQLColumn.class_exec do
2043
+ alias :_brick_initialize :initialize
2044
+ def initialize(*args, **kwargs)
2045
+ kwargs.merge!(args.pop) if args.last.is_a?(Hash)
2046
+ _brick_initialize(*args, **kwargs)
2047
+ end
2048
+ end
2049
+ end
2050
+
2029
2051
  require 'active_model'
2030
2052
  begin
2031
2053
  require 'active_model/type'
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.176
4
+ version: 1.0.178
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorin Thwaits
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-17 00:00:00.000000000 Z
11
+ date: 2023-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord