dynamic-active-model 0.3.2 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cdcc2e62dea9d605f8b3d2b9082eb6e59c74a719ec83f09b4e5f3ce885e4d6e5
4
- data.tar.gz: 4009f174fac279cbb93cbcf6b81b9eedfe04d0588aad1dda7bee9e1976331141
3
+ metadata.gz: 80a26c3336b3adc4aeb32e82699b5c6b88fd3ee1722fccdef4b5078a8aef2776
4
+ data.tar.gz: 45755211d6c67e8f4646923e1082977e2906ff464ef40c81cd93fbfb6b01c8ff
5
5
  SHA512:
6
- metadata.gz: 5dd5dcefb823f3ffafbf16e15d4a996dbd3ca8967753c1465f8cc5952e1d3e47ea82316a4f6f7041e69064edcc8865b9ec4661798a3c133262cc7a302d7fb7e1
7
- data.tar.gz: 5e878ef66b9fdef4fdef973a5b43ab046934739bf6f5847ed769cacb80993b1615baa7bf1f8ac5ad8656e2a5c4654601c6eab919cbc5c5d3f3c0dc814bcb253d
6
+ metadata.gz: 2e0cdd29bea6837ade3759c9fb9105784d2a94b4fa2583db7591f598e0b784a8e256809ffafd93f0d4ee01aff8ffcef5fd1064e8bd325b060ee89b9a832b7848
7
+ data.tar.gz: 676d3f6c102f9b011cf5bde8a35df44c6e0b45cd9106fdcc2fb1ed794c5b1b40c50f7a6c6b241a07b88f6aa4241487f033419c225e8664f38f64e035441b2b92
@@ -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.send(: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
@@ -47,7 +47,10 @@ module DynamicActiveModel
47
47
  # rubocop:enable MethodLength
48
48
 
49
49
  def generate_class_name(table_name)
50
- table_name.classify
50
+ class_name = table_name.classify
51
+ return ('N' + class_name) if class_name =~ /\A\d/
52
+
53
+ class_name
51
54
  end
52
55
  end
53
56
  end
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.2
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-07 00:00:00.000000000 Z
11
+ date: 2022-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  requirements: []
62
- rubygems_version: 3.1.2
62
+ rubygems_version: 3.3.3
63
63
  signing_key:
64
64
  specification_version: 4
65
65
  summary: Dynamic ActiveRecord Models