weak_parameters 0.0.5 → 0.0.6

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: 574d6b069ecee483c92abe98a1f0aeefc6c77ce1
4
- data.tar.gz: 3f69d7e525b372617d94ab264dcaaa69602943df
3
+ metadata.gz: 9c6878ecd190cfb4d8e53e6c9e1eda47da7e3a05
4
+ data.tar.gz: 564512fd5e6eacf4989916a74ad7c389c9f8801c
5
5
  SHA512:
6
- metadata.gz: cc55b3b93a4fd17d76fe10d17c011158c69439aa2d7f79c512588d7439122542014bb7372096e583e8f1db739ff566ef95c476757e4c8398d332c829798ff376
7
- data.tar.gz: f1577e70e84ffdbe6bd96dd03cf85cae30f733736da65628d2e2f387ea96a73c8a9ed7484f0b4e1ea77829c92b6b1a41b3248b108d5015898483d2c7cae63bef
6
+ metadata.gz: a3792e6192ef2cb3a36b22254e28049a58897b837622448f88b08d7e565d255e794dd6bdf285a40cd0b7154012d898dc48896138e91a8dbdfbe826d5d6e1e861
7
+ data.tar.gz: 24d0d59133f5e683e05f8df4d50a67681fada003e3b42fcb2a30ea2f7dfadf89971e8a2f53b804763569c30293a2fa4b110063a3eab33dc2eaec015f26932bd3
data/README.md CHANGED
@@ -12,7 +12,7 @@ gem "weak_parameters"
12
12
  class RecipesController < ApplicationController
13
13
  validates :create do
14
14
  string :name, required: true, except: ["charlie", "dave"]
15
- integer :type, only: "1".."3"
15
+ integer :type, only: 1..3
16
16
  end
17
17
 
18
18
  def create
@@ -7,5 +7,11 @@ module WeakParameters
7
7
  def error_message
8
8
  "params[#{key.inspect}] must be an Integer"
9
9
  end
10
+
11
+ private
12
+
13
+ def value
14
+ super.presence.try(:to_i)
15
+ end
10
16
  end
11
17
  end
@@ -1,3 +1,3 @@
1
1
  module WeakParameters
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  class RecipesController < ApplicationController
2
2
  validates :create do
3
3
  string :name, required: true, except: %w[invalid wrong]
4
- integer :type, only: "1".."3"
4
+ integer :type, only: 1..3
5
5
  boolean :flag
6
6
  hash :config
7
7
  array :tags
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weak_parameters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-18 00:00:00.000000000 Z
11
+ date: 2013-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails