https://github.com/ivanvc/routing_params_filters
Sends specified methods to the params
https://github.com/ivanvc/routing_params_filters
Last synced: over 1 year ago
JSON representation
Sends specified methods to the params
- Host: GitHub
- URL: https://github.com/ivanvc/routing_params_filters
- Owner: ivanvc
- License: mit
- Created: 2010-02-18T21:24:58.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2010-02-18T21:25:33.000Z (over 16 years ago)
- Last Synced: 2025-01-23T20:52:59.833Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 70.3 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: MIT-LICENSE
Awesome Lists containing this project
README
RoutingParamsFilters
====================
This plugin enables the ability of adding filters, or sending methods to the parameters you are expecting to read from the URL. It's useful if you are expecting to read an integer, a collection of values, etc.
Example
=======
In your routes.rb file:
ActionController::Routing::Routes.draw do |map|
map.connect "/something/:something_id",
:controller => 'some',
:action => 'create',
:conditions => { :method => :post, :something_id => :to_i }
...
end
Then:
curl -X POST "http://localhost:3000/something/123"
Parameters: {"action"=>"create", "something_id"=>123, "controller"=>"entries"}
You can even do other things like
map.connect "/something/:something_id",
:controller => 'some',
:action => 'create',
:conditions => { :method => :post, :something_id => "split(',')" }
So:
curl -X POST "http://localhost:3000/something/123,456,789"
Parameters: {"action"=>"create", "something_id"=>["123","456","789"], "controller"=>"entries"}
Copyright (c) 2010 Ivan Valdes Castillo, released under the MIT license