Module: Waves::ResponseMixin

Included in:
Controllers::Mixin, ResponseProxy, Views::Mixin
Defined in:
lib/runtime/response_mixin.rb

Overview

Defines a set of methods that simplify accessing common request and response methods. These include methods not necessarily associated with the Waves::Request and Waves::Response objects, but which may still be useful for constructing a response.

This mixin assumes that a @request@ accessor already exists.

Instance Method Summary collapse

Instance Method Details

#controllersObject

Access the primary application’s controllers



28
# File 'lib/runtime/response_mixin.rb', line 28

def controllers; Waves.application.controllers; end

#domainObject

Access the request domain.



20
# File 'lib/runtime/response_mixin.rb', line 20

def domain; request.domain; end

#logObject

Access the Waves::Logger.



32
# File 'lib/runtime/response_mixin.rb', line 32

def log; Waves::Logger; end

#modelsObject

Access the primary application’s models



24
# File 'lib/runtime/response_mixin.rb', line 24

def models; Waves.application.models; end

#not_foundObject

Raise a “not found” exception.



30
# File 'lib/runtime/response_mixin.rb', line 30

def not_found; request.not_found; end

#paramsObject

Access the request parameters.



12
# File 'lib/runtime/response_mixin.rb', line 12

def params; request.params; end

#pathObject

Access the request path.



16
# File 'lib/runtime/response_mixin.rb', line 16

def path; request.path; end

#redirect(location, status = '302') ⇒ Object

Issue a redirect for the given location.



22
# File 'lib/runtime/response_mixin.rb', line 22

def redirect(location, status = '302'); request.redirect(location, status); end

#responseObject

Access the response.



10
# File 'lib/runtime/response_mixin.rb', line 10

def response; request.response; end

#sessionObject

Access the request session.



14
# File 'lib/runtime/response_mixin.rb', line 14

def session; request.session; end

#urlObject

Access the request url.



18
# File 'lib/runtime/response_mixin.rb', line 18

def url; request.url; end

#viewsObject

Access the primary application’s views



26
# File 'lib/runtime/response_mixin.rb', line 26

def views; Waves.application.views; end