README.md in weak_parameters-0.1.2 vs README.md in weak_parameters-0.1.3
- old
+ new
@@ -6,10 +6,20 @@
gem "weak_parameters"
```
## Usage
```ruby
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+
+ respond_to :json
+
+ rescue_from WeakParameters::ValidationError do
+ head 400
+ end
+end
+
# 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
@@ -43,9 +53,15 @@
* float
* hash
* integer
* string
* boolean (= 0, 1, false, true)
+
+### Avilable options
+* required
+* only
+* except
+* handler
## Tips
WeakParameters.stats returns its validation metadata, and this is useful for auto-generating API documents.
With [autodoc](https://github.com/r7kamura/autodoc), you can auto-generate API documents with params information.