Module: ActionDispatch::Routing::Mapper::MapRestfully
- Included in:
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/map_restfully.rb
Instance Method Summary collapse
Instance Method Details
#map_restfully(resource_name, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/map_restfully.rb', line 5 def map_restfully(resource_name, ={}) singular = resource_name.to_s plural = [:plural] || singular.pluralize %w(get post put delete).each do |verb| match({"#{singular}(/:id(.:format))" => "#{plural}##{verb}", :via => verb, :as => singular}.merge()) match "#{plural}(/:ids(.:format))" => "#{plural}##{verb}s", :via => verb, :as => plural end end |