module Utopia::Controller::Rewrite

This controller layer rewrites the path before executing controller actions. When the rule matches, the supplied block is executed. @example

prepend Rewrite
rewrite.extract_prefix id: Integer do
        @user = User.find(@id)
end

Public Class Methods

prepended(base) click to toggle source
# File lib/utopia/controller/rewrite.rb, line 35
def self.prepended(base)
        base.extend(ClassMethods)
end

Public Instance Methods

process!(request, path) click to toggle source

Rewrite the path before processing the request if possible.

Calls superclass method
# File lib/utopia/controller/rewrite.rb, line 116
def process!(request, path)
        catch_response do
                self.class.rewrite_request(self, request, path)
        end || super
end