trenchcoat 0.1.0 → 0.2.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 +4 -4
- data/.rubocop.yml +4 -0
- data/README.md +2 -4
- data/lib/trenchcoat/version.rb +1 -1
- data/lib/trenchcoat.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ab1043005d9403e859adae46b633f3ae255a7d4145ec32a185d3205a8e54af8
|
4
|
+
data.tar.gz: 26d16373edc25738c88256734370c7dff4d92e95a8ad1322d28090043a8abebf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 564b53fbbfa5bf36c243bdda4a2caab82708e1ebc05900e8c9d7d48b911444a869cffef901f6210c2f48ce094d1fb9662dc3e341acb04d0798d8774a4b514dbc
|
7
|
+
data.tar.gz: d1e30cebfaddb4f93ba35fee83a84189a5abe6d0380595a75f3f360aeb0aa21cdf14a733fbb6b400d0de1e3d27a8ca4b81c27b8b0deafff5876143a32cdd9fc4
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -2,15 +2,13 @@
|
|
2
2
|
|
3
3
|
## Installation
|
4
4
|
|
5
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
6
|
-
|
7
5
|
Install the gem and add to the application's Gemfile by executing:
|
8
6
|
|
9
|
-
$ bundle add
|
7
|
+
$ bundle add trenchcoat
|
10
8
|
|
11
9
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
12
10
|
|
13
|
-
$ gem install
|
11
|
+
$ gem install trenchcoat
|
14
12
|
|
15
13
|
## Usage
|
16
14
|
|
data/lib/trenchcoat/version.rb
CHANGED
data/lib/trenchcoat.rb
CHANGED
@@ -8,9 +8,9 @@ module Trenchcoat
|
|
8
8
|
module Model
|
9
9
|
extend ActiveSupport::Concern
|
10
10
|
|
11
|
-
def fallback_to_model_values(model:,
|
12
|
-
|
13
|
-
next if
|
11
|
+
def fallback_to_model_values(model:, attributes_to_check:, original_attributes_hash:)
|
12
|
+
attributes_to_check.each do |attribute|
|
13
|
+
next if original_attributes_hash.with_indifferent_access.key?(attribute)
|
14
14
|
|
15
15
|
send(:"#{attribute}=", model.public_send(attribute))
|
16
16
|
end
|
@@ -22,7 +22,7 @@ module Trenchcoat
|
|
22
22
|
|
23
23
|
attributes.each do |attribute_name|
|
24
24
|
column = columns.fetch(attribute_name)
|
25
|
-
attribute column.name,
|
25
|
+
attribute column.name, model_class.type_for_attribute(attribute_name), default: column.default
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|