settingson 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -5
- data/app/models/concerns/settingson/base.rb +3 -1
- data/lib/settingson/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8579587c314ae14727b474c57fba7ffec603582c
|
4
|
+
data.tar.gz: b6ebb2019311b74a938aab332e8ee36b528c9766
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9762516ab291030a72d63113b88bcb91d817acb30924d9ff93816709f2a67cf73144f4ad3c1f11270b6e5a05e6ab562c8f35a1518a78028a8bac6dabd78c2e57
|
7
|
+
data.tar.gz: 9c8cd370388a921dd0d15275f2bba72110e185b1b621fdf14a477241984e0dc8dc56eaadc32ef58b56be426356e87f4512ed9f0a14d534a360833f49da4efa27
|
data/README.md
CHANGED
@@ -28,12 +28,14 @@ Settings.array # => [1, 2, 3, 4, 5]
|
|
28
28
|
# Array of hashes
|
29
29
|
Settings.array.of.hashes = [ { hello: :world}, {'glad' => :to}, {see: 'you'} ]
|
30
30
|
Settings.array.of.hashes # => [{:hello=>:world}, {"glad"=>:to}, {:see=>"you"}]
|
31
|
+
```
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
Settings.server
|
36
|
-
|
33
|
+
### Using with [Simple Form](https://github.com/plataformatec/simple_form) and [Haml](https://github.com/haml/haml)
|
34
|
+
in view:
|
35
|
+
```ruby
|
36
|
+
= simple_form_for Settings.server do |f|
|
37
|
+
= f.input :host
|
38
|
+
= f.input :port
|
37
39
|
```
|
38
40
|
|
39
41
|
## Installation
|
@@ -15,7 +15,9 @@ module Settingson::Base
|
|
15
15
|
|
16
16
|
@settingson = "#{@settingson}.#{$1}"
|
17
17
|
|
18
|
-
if record = self.class.find_by(name: @settingson)
|
18
|
+
if record = self.class.find_by(name: @settingson) and args.first.nil?
|
19
|
+
record.destroy
|
20
|
+
elsif record
|
19
21
|
record.update(value: args.first.to_yaml)
|
20
22
|
else
|
21
23
|
self.class.create(name: @settingson, value: args.first.to_yaml)
|
data/lib/settingson/version.rb
CHANGED