tina4ruby 3.10.66 → 3.10.67

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: 13acdd49bf29d256910ee8f803a6cd0983d9b38a903d3bc3e3efbba4bc07b565
4
- data.tar.gz: 2e344b8b471db71b218d29e69d18d0aa0f3b3d8493e60840f5d409c9c2807c31
3
+ metadata.gz: e5ba81bb86f837e23521b7b13d2ee313a0ac7e34bbf04371c4256d00b077c7f3
4
+ data.tar.gz: 9bb8a43825801b904b30bddcfbc51fedc74694bb04d37d404d33702338d40806
5
5
  SHA512:
6
- metadata.gz: b314ccc66d3cc707e5efcaf27a162da73d2f84255faf1cde06369b11144591c58223f007808415f9697d3d158d496786baeda362a20ceafb7eddd4d5e4ec450c
7
- data.tar.gz: 1117b18973c2f6c44b28caa2d18f6064b3ce63fa4f0e6d4a6a88250c448bd2133a026b05a4f85978a7cf38473043d9d41e440c7a6b92af8693ef78af3ece5a27
6
+ metadata.gz: 29819ac550ac637dbc6bd3fb3456e426a2311cdbabc6cbe9953d4b03317ecb5eca6f55f5f70b69f515db433135b221fb45320f7aad3ded354b56a9772f150da2
7
+ data.tar.gz: 2ae5fc934297b48c3352aab9bc6606dba1553adc91e989efe8b301a6163e291eeec9f79d592a2a781ea34528b13b75a6cf8d55714f4795b5da80984c9be6e165
data/lib/tina4/orm.rb CHANGED
@@ -481,29 +481,15 @@ module Tina4
481
481
  errors
482
482
  end
483
483
 
484
- def load(filter_sql = nil, params = [])
485
- @relationship_cache = {} # Clear relationship cache on reload
486
-
487
- pk = self.class.primary_key_field || :id
488
-
489
- # Determine the SQL to execute
490
- if filter_sql.nil? || filter_sql.is_a?(Integer)
491
- # Legacy: load by primary key (load() or load(id))
492
- id = filter_sql || __send__(pk)
493
- return false unless id
494
- sql = "SELECT * FROM #{self.class.table_name} WHERE #{pk} = ?"
495
- query_params = [id]
496
- else
497
- # Filter-based: load("email = ?", ["alice@example.com"])
498
- sql = "SELECT * FROM #{self.class.table_name} WHERE #{filter_sql}"
499
- query_params = params
500
- end
501
-
502
- result = self.class.db.fetch_one(sql, query_params)
484
+ # Load a record into this instance via select_one.
485
+ # Returns true if found and loaded, false otherwise.
486
+ def load(sql, params = [], include: nil)
487
+ @relationship_cache = {}
488
+ result = self.class.select_one(sql, params, include: include)
503
489
  return false unless result
504
490
 
505
491
  mapping_reverse = self.class.field_mapping.invert
506
- result.each do |key, value|
492
+ result.to_h.each do |key, value|
507
493
  attr_name = mapping_reverse[key.to_s] || key
508
494
  setter = "#{attr_name}="
509
495
  __send__(setter, value) if respond_to?(setter)
data/lib/tina4/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tina4
4
- VERSION = "3.10.66"
4
+ VERSION = "3.10.67"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tina4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.66
4
+ version: 3.10.67
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tina4 Team