README.md in weak_parameters-0.0.7 vs README.md in weak_parameters-0.0.8
- old
+ new
@@ -11,10 +11,13 @@
# WeakParameters provides `validates` class method to define validations.
class RecipesController < ApplicationController
validates :create do
string :name, required: true, except: ["charlie", "dave"]
integer :type, only: 1..3
+ string :quantity do |value|
+ value =~ /\A\d+(?:\.\d+)g\z/
+ end
end
def create
respond_with Recipe.create(params.slice(:name, :type))
end
@@ -34,9 +37,10 @@
=> 400
```
### Available validators
* array
+* float
* hash
* integer
* string
* boolean (= 0, 1, false, true)