rails-settings-cached 2.5.0 → 2.5.1

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: f37f8d9bad4b40dd60dbf30806e1e530e1d292448ba803db06bdcca5f562c62e
4
- data.tar.gz: 2900b13077db46b60b2c22cfa3a21b7af5704b86d874d485672508c8ef866475
3
+ metadata.gz: 29703d30ef00244c99b49047ce3a05edd212ee71a23433cb581d5bf69c6a02c6
4
+ data.tar.gz: 7f1d2dffdf1c552faca1b7afdbaaeaa52039897afb5364b8aef37de3d93389c4
5
5
  SHA512:
6
- metadata.gz: c696568044b97ce9a9112de42682a7e484e13a8220e0d7b1b52d5977f56358f82109e4bb1dd8b227f89089d060a49454b2bd1c86ac4cc7fbfc2c275bf0a48c55
7
- data.tar.gz: c2eb40491e08ce8eefe6d96e6d987fd9a02efbad708e9a1ae0442d98b82e626300ee90eda5664be385aa81178c4be4a19b190d623a2ff8cdb0d8e0f8b53d0649
6
+ metadata.gz: 6e1b41ac975dd31fadf90c5d9c059542aaeb09a0bfbf3f137266a32ae58c30557afedbe33c775af9a2683a8f8b56b85ee0f94b4a063a27e5c79176b5c1714d0d
7
+ data.tar.gz: a5ee74e8dd391aab429db68904b5d78a79581fd41de6304aece887fcdf9be8b023f4fff03a2fedbfdbc81cff964be5b695a90c5e4c3f908d49bed01c0fb70f83
data/README.md CHANGED
@@ -162,9 +162,23 @@ class Setting < RailsSettings::Base
162
162
  end
163
163
  ```
164
164
 
165
- Now validate will work on record save.
165
+ Now validate will work on record save:
166
166
 
167
167
  ```rb
168
+ irb> Setting.app_name = ""
169
+ ActiveRecord::RecordInvalid: (Validation failed: App name can't be blank)
170
+ irb> Setting.app_name = "Rails Settings"
171
+ "Rails Settings"
172
+ irb> Setting.default_locale = "zh-TW"
173
+ ActiveRecord::RecordInvalid: (Validation failed: Default locale is not included in [zh-CN, en, jp])
174
+ irb> Setting.default_locale = "en"
175
+ "en"
176
+ ```
177
+
178
+ Validate by `save` / `valid?` method:
179
+
180
+ ```rb
181
+
168
182
  setting = Setting.find_or_initialize_by(var: :app_name)
169
183
  setting.value = ""
170
184
  setting.valid?
@@ -95,7 +95,7 @@ module RailsSettings
95
95
  value = send(:_convert_string_to_typeof_value, type, value, separator: separator)
96
96
 
97
97
  record.value = value
98
- record.save(validate: false)
98
+ record.save!
99
99
 
100
100
  value
101
101
  end
@@ -3,7 +3,7 @@
3
3
  module RailsSettings
4
4
  class << self
5
5
  def version
6
- "2.5.0"
6
+ "2.5.1"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-settings-cached
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-08 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.0.8
152
+ rubygems_version: 3.2.0
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: The best solution for store global settings in Rails applications.