dynamic-active-model 0.3.1 → 0.4.1

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: 939a4bf825472966414c9210ace20b328cb96b3346c64c81063abf0caf2b6e88
4
- data.tar.gz: 731d11dd2939d33a0a9425258a04c51ef1b5e3c664268fad76a4164e0a04ed69
3
+ metadata.gz: 20969c7130d6dd1e4d9fd94404fa7c1429657bcf8c2f7a952521e3518585b2d3
4
+ data.tar.gz: 8e0ac474187143c277e4a6534d22a7755a7866bc7f1369c4134502b2e9bf702c
5
5
  SHA512:
6
- metadata.gz: 13bbbc17ce25badff6dc5c19fb675813897d80a76b65fd4d4d52562bf7ae0051536506be6f04a293d8a31e9dc2a538649bbce7a9da07c2c19cb737f37e9d14bb
7
- data.tar.gz: 3e3b46e5c905c588ad2d3885bf5b18843806ac61afece97c5a210440c1b6692578bf38a7109a9b45e20420d216b7b2efb0963a6f6a59ab102b2d44cf5f4f6ca3
6
+ metadata.gz: e389fb994f7dfc8231f9d464ec5306328c819826b699da3b77345650d2fa7227d1c03cf743334aa4a6ba9a9f1ea6341adc50373a0a14f734c6650aa972fd52d9
7
+ data.tar.gz: cb2dfb3348ee6d301154214a0e51ac638f54779cecfa10d398812845d41531f8f57b7ae4e286d5f393cdbfcf12cb49c629bd4af3c818ca9bc2316c1a645293e3
@@ -5,16 +5,9 @@ module DynamicActiveModel
5
5
  # from attribute_names method in ActiveRecord
6
6
  module DangerousAttributesPatch
7
7
  def self.included(base)
8
- base.singleton_class.alias_method :original_attribute_names, :attribute_names
9
- base.extend ClassMethods
10
- end
11
-
12
- # no-doc
13
- module ClassMethods
14
- def attribute_names
15
- names = original_attribute_names
16
- names.reject! { |name| dangerous_attribute_method?(name) }
17
- names
8
+ if base.attribute_names
9
+ columns_to_ignore = base.attribute_names.select { |name| base.dangerous_attribute_method?(name) }
10
+ base.ignored_columns = columns_to_ignore
18
11
  end
19
12
  end
20
13
  end
@@ -63,6 +63,13 @@ module DynamicActiveModel
63
63
  @include_tables + @include_table_matchers
64
64
  end
65
65
 
66
+ def disable_standard_table_inheritance!
67
+ models.each do |model|
68
+ model.inheritance_column = :_type_disabled if model.attribute_names.include?('type')
69
+ end
70
+ end
71
+ alias disable_sti! disable_standard_table_inheritance!
72
+
66
73
  private
67
74
 
68
75
  def skip_table?(table_name)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic-active-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-29 00:00:00.000000000 Z
11
+ date: 2022-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -44,7 +44,7 @@ homepage: https://github.com/dougyouch/dynamic-active-model
44
44
  licenses:
45
45
  - MIT
46
46
  metadata: {}
47
- post_install_message:
47
+ post_install_message:
48
48
  rdoc_options: []
49
49
  require_paths:
50
50
  - lib
@@ -59,8 +59,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  requirements: []
62
- rubygems_version: 3.0.3
63
- signing_key:
62
+ rubygems_version: 3.2.3
63
+ signing_key:
64
64
  specification_version: 4
65
65
  summary: Dynamic ActiveRecord Models
66
66
  test_files: []