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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aec49dc850a44eb78c90e349546810759bfa4ef4
4
- data.tar.gz: de34ec83bacbd07f598ca0523cb99c0ca3e4c4b2
3
+ metadata.gz: 8579587c314ae14727b474c57fba7ffec603582c
4
+ data.tar.gz: b6ebb2019311b74a938aab332e8ee36b528c9766
5
5
  SHA512:
6
- metadata.gz: 55f3b02731359aeab98f25d92bd3dc47e789c2ecea198678f0829206d2c227848d7e943e730f55a50c5a7b2278b39c19f38c408e452f0470a6bed5160b542ecd
7
- data.tar.gz: d68db1634e51420cf1bdefbc22357cfb7bf006803264875dc820637886066d39036a0acb20d8c384f9cc21c9902ba1449406e451eece85ff3bf00027330966c2
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
- Settings.server[:host, :port, :role] = [ '127.0.0.1', 3000, :web ]
33
- Settings.server[:host, :port, :role] # => ["127.0.0.1", 3000, :web]
34
- Settings.server.host # => '127.0.0.1'
35
- Settings.server.port # => 3000
36
- Settings.server.role # => :web
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)
@@ -1,3 +1,3 @@
1
1
  module Settingson
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: settingson
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - dan