Module | Camping::Helpers |
In: |
lib/reststop.rb
|
R | -> | _R |
Overrides Camping‘s routing helper to make it possible to route RESTful resources.
Some usage examples:
R(Kittens) # /kittens R(Kittens, 'new') # /kittens/new R(Kittens, 1, 'meow') # /kittens/1/meow R(@kitten) # /kittens/1 R(@kitten, 'meow') # /kittens/1/meow R(Kittens, 'list', :colour => 'black') # /kittens/list?colour=black
The current output format is retained, so if the current @format is :XML, the URL will be /kittens/1.xml rather than /kittens/1.
Note that your controller names might not be loaded if you‘re calling R inside a view module. In that case you should use the fully qualified name (i.e. Myapp::Controllers::Kittens) or include the Controllers module into your view module.