administrate-field-jsonb 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/administrate-field-jsonb.gemspec +1 -1
- data/lib/administrate/field/jsonb.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52209531e57fde3e665caf40eecc5d76c6e43b878f00b3a8881f4b74e1d57ab3
|
4
|
+
data.tar.gz: 8c9908a227df51cc20c04b05869564334b242a02c729c996faf6e0e828ed2424
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67893b05ca6c084eca1a5fe4790d91213db15797ccb3c406f8ebdf6439a976945328e7d9568c50f314a6688a65aafae4a207ae258d43c960ee03ffbbeeeb05a8
|
7
|
+
data.tar.gz: b8257459ee97d75c948dc363136db331b0a564c74a82e4f2ef3b138d3ab96d82c7149cd6b16888b8985250beb1507da34370d5ba8c74b5e59b38aeee01bf1732
|
data/README.md
CHANGED
@@ -102,6 +102,17 @@ ATTRIBUTE_TYPES = {
|
|
102
102
|
}.freeze
|
103
103
|
```
|
104
104
|
|
105
|
+
In some situations you may preffer not to nullify empty records. For example you store your JSONB in `not null` database column and always have at least an empty json object `{}`. In such situation you can use `nil_blank` option:
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
ATTRIBUTE_TYPES = {
|
109
|
+
# ...
|
110
|
+
details: Field::JSONB.with_options(
|
111
|
+
nil_blank: false
|
112
|
+
)
|
113
|
+
}.freeze
|
114
|
+
```
|
115
|
+
|
105
116
|
## How it looks like
|
106
117
|
|
107
118
|
### Form
|
@@ -2,7 +2,7 @@ $LOAD_PATH.push File.expand_path('lib', __dir__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'administrate-field-jsonb'
|
5
|
-
gem.version = '0.4.
|
5
|
+
gem.version = '0.4.7'
|
6
6
|
gem.authors = ['Sergey Volkov', 'Codica']
|
7
7
|
gem.email = ['sergvolkov.codica@gmail.com']
|
8
8
|
gem.homepage = 'https://github.com/codica2/administrate-field-jsonb'
|
@@ -9,7 +9,7 @@ module Administrate
|
|
9
9
|
class JSONB < Administrate::Field::Base
|
10
10
|
|
11
11
|
def transform
|
12
|
-
return nil if data.blank?
|
12
|
+
return nil if data.blank? && (!options.key?(:nil_blank) || options[:nil_blank] == true)
|
13
13
|
return data unless options[:transform].present? && options[:transform].is_a?(Array)
|
14
14
|
|
15
15
|
result = data
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administrate-field-jsonb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Volkov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: administrate
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
- !ruby/object:Gem::Version
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
|
-
rubygems_version: 3.
|
110
|
+
rubygems_version: 3.5.16
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: JSONb field plugin for Administrate
|