ParameterValidation Build Status

Enables validation, defaults and error messages for your params. Supports all validations which ActiveModel supports.

Installation

Add this line to your application’s Gemfile:

gem 'parameter_validation'

And then execute:

$ bundle

Or install it yourself as:

$ gem install parameter_validation

Usage

Use it in your controller actions like:

```ruby rescue_from ParameterValidation::ParamsException do |e| render :json => => e.errors end

def index validations = => {:numericality => {:greater_than => 0,:default => 1}} @params = validate_params_for(validations)

@params[:page]
  ...   ```

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

This gem is created by Viktor Mazetti and is under the MIT License.