/usr/lib/ruby/1.8/ramaze/contrib/rest.rb is in libramaze-ruby1.8 2010.06.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Use this together with the Rack::MethodOverride middleware for best
# behaviour.
#
# See spec/contrib/rest.rb for usage.
module Ramaze
# Don't use one option per method, we don't want to turn request_method into
# a symbol, together with MethodOverride this could lead to a memory leak.
options.o "REST rewrite mapping",
:rest_rewrite, { 'GET' => 'show',
'POST' => 'create',
'PUT' => 'update',
'DELETE' => 'destroy'}
Rewrite['REST dispatch'] = lambda{|path, request|
if suffix = Ramaze.options[:rest_rewrite][request.request_method]
"#{path}/#{suffix}".squeeze('/')
else
path
end
# return '/'
}
end
|