module Roda::RodaPlugins::Path
The path plugin adds support for named paths. Using the path
class method, you can easily create *_path
instance methods for each named path. Those instance methods can then be called if you need to get the path for a form action, link, redirect, or anything else. Example:
plugin :path path :foo, '/foo' path :bar do |bar| "/bar/#{bar.id}" end route do |r| r.post 'bar' do bar = Bar.create(r.params['bar']) r.redirect bar_path(bar) end end