Module: Roda::RodaPlugins::Path

Defined in:
lib/roda/plugins/path.rb

Overview

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

Defined Under Namespace

Modules: ClassMethods