dynamic-active-model 0.7.2 → 0.8.0

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: 2664e9a3b74032d4296a54416912c82bf4f23ce605867215b95676d889d791ed
4
- data.tar.gz: 9a85b302c4ed61002b9379f2b1b9812632d2c51696dfa2e1e4b02ec1546eac89
3
+ metadata.gz: df4da0b0a5a5026754e0624dd508604ac4796ac3f60f37fa82018691fa596f3f
4
+ data.tar.gz: d42ea5435c3ad98e7bb6e9c4489df62db14b7b6199df3e0247989ad7b8a6a725
5
5
  SHA512:
6
- metadata.gz: 475f4bf0369216319169d75505800bc795cc7077b3aaa9e599eaf6b3c167093bc423bd280ad8d4435887b0883ff75b9463cfecd047fa1646d1b7a11ec737aa87
7
- data.tar.gz: 1d6081d4fa6c1d36d8e9d9b68392219d85ff2cc50eade08f879c5f56fbb61fa46ec3c1ea6ba475453142f430822fd4361540fdb3f1834ddff18b456d59a72528
6
+ metadata.gz: 986938faee17bc087e8260f468bf6c346244e291527c0f827b0ce0e227d079b22c082848eadb202a93d51798124787e496f343c9c4221eec0db652b3d3cb8218
7
+ data.tar.gz: f0d2af7a8da7d120dc82b3600ed8b3daef0a5d0eb7c581a2fc60dbc205b0440cb27cf01d792ffb0aeaa481756db5d63e603e2548ea3e5153b007c6ebffdce4b8
@@ -153,7 +153,7 @@ module DynamicActiveModel
153
153
  if file
154
154
  updater = ModelUpdater.new(model)
155
155
  ctx = updater.instance_eval { binding }
156
- eval(File.read(file), ctx, file, 1)
156
+ eval(File.read(file), ctx, file, 1) # rubocop:disable Security/Eval -- extension files are trusted code
157
157
  end
158
158
  model.class_eval(&block) if block
159
159
  model
@@ -62,33 +62,25 @@ module DynamicActiveModel
62
62
  # Gets all has_many relationships for the model
63
63
  # @return [Array<ActiveRecord::Reflection::HasManyReflection>]
64
64
  def all_has_many_relationships
65
- @model.reflect_on_all_associations.select do |assoc|
66
- assoc.is_a?(ActiveRecord::Reflection::HasManyReflection)
67
- end
65
+ @model.reflect_on_all_associations.grep(ActiveRecord::Reflection::HasManyReflection)
68
66
  end
69
67
 
70
68
  # Gets all belongs_to relationships for the model
71
69
  # @return [Array<ActiveRecord::Reflection::BelongsToReflection>]
72
70
  def all_belongs_to_relationships
73
- @model.reflect_on_all_associations.select do |assoc|
74
- assoc.is_a?(ActiveRecord::Reflection::BelongsToReflection)
75
- end
71
+ @model.reflect_on_all_associations.grep(ActiveRecord::Reflection::BelongsToReflection)
76
72
  end
77
73
 
78
74
  # Gets all has_one relationships for the model
79
75
  # @return [Array<ActiveRecord::Reflection::HasOneReflection>]
80
76
  def all_has_one_relationships
81
- @model.reflect_on_all_associations.select do |assoc|
82
- assoc.is_a?(ActiveRecord::Reflection::HasOneReflection)
83
- end
77
+ @model.reflect_on_all_associations.grep(ActiveRecord::Reflection::HasOneReflection)
84
78
  end
85
79
 
86
80
  # Gets all has_and_belongs_to_many relationships for the model
87
81
  # @return [Array<ActiveRecord::Reflection::HasAndBelongsToManyReflection>]
88
82
  def all_has_and_belongs_to_many_relationships
89
- @model.reflect_on_all_associations.select do |assoc|
90
- assoc.is_a?(ActiveRecord::Reflection::HasAndBelongsToManyReflection)
91
- end
83
+ @model.reflect_on_all_associations.grep(ActiveRecord::Reflection::HasAndBelongsToManyReflection)
92
84
  end
93
85
 
94
86
  # Appends an association definition to the source string
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DynamicActiveModel
4
+ # Gem version, bumped by release-please
5
+ VERSION = '0.8.0'
6
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'dynamic-active-model/version'
4
+
3
5
  # DynamicActiveModel is a Ruby gem that provides automatic database discovery,
4
6
  # model creation, and relationship mapping for Rails applications.
5
7
  #
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic-active-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-02-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activerecord
@@ -58,6 +58,7 @@ files:
58
58
  - lib/dynamic-active-model/foreign_key.rb
59
59
  - lib/dynamic-active-model/setup.rb
60
60
  - lib/dynamic-active-model/template_class_file.rb
61
+ - lib/dynamic-active-model/version.rb
61
62
  homepage: https://github.com/dougyouch/dynamic-active-model
62
63
  licenses:
63
64
  - MIT
@@ -77,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
78
  - !ruby/object:Gem::Version
78
79
  version: '0'
79
80
  requirements: []
80
- rubygems_version: 3.6.2
81
+ rubygems_version: 4.0.20
81
82
  specification_version: 4
82
83
  summary: Automatically discover database schemas and create ActiveRecord models with
83
84
  relationships