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. 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



33
34
35
# File 'lib/utopia/controller/rewrite.rb', line 33

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

Instance Method Details

#process!(request, path) ⇒ Object

Rewrite the path before processing the request if possible.



110
111
112
113
114
# File 'lib/utopia/controller/rewrite.rb', line 110

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