Module: Utopia::Controller::Rewrite

Defined in:
lib/utopia/controller/rewrite.rb

Overview

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

Examples:

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

Defined Under Namespace

Modules: ClassMethods Classes: ExtractPrefixRule, Rewriter, Rule

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



18
19
20
# File 'lib/utopia/controller/rewrite.rb', line 18

def self.prepended(base)
	base.extend(ClassMethods)
end

Instance Method Details

#process!(request, path) ⇒ Object

Rewrite the path before processing the request if possible.



99
100
101
102
103
# File 'lib/utopia/controller/rewrite.rb', line 99

def process!(request, path)
	catch_response do
		self.class.rewrite_request(self, request, path)
	end || super
end