An open API service indexing awesome lists of open source software.

https://github.com/bumi/params_required

Rails plugin to validate if certain params are present.
https://github.com/bumi/params_required

Last synced: 4 months ago
JSON representation

Rails plugin to validate if certain params are present.

Awesome Lists containing this project

README

          

ParamsRequired
=============

params_required adds a before_filter which tests if certain params are set. Otherwise HTTP status 404 will be rendered.

Example
=======

params_required( [array] required params, [hash] before_filter options)

class PostsController < ApplicationController

# tests if params[:blog_id] and params[:user_id] are present
params_required :blog_id, :user_id, :except => [:show]

# tests if params[:user][:blog_id] is present
params_required :user => :blog_id

end

Note
======

this is experimental and perhaps there are better ways to do something like this?

Copyright (c) 2008 [Michael Bumann], released under the MIT license