class RackStep::Controller
Abstract controller class with some helper methods. ALL your controllers MUST use this one as a superclass.
Attributes
The request will be injected here.
The Rack::Response object that will be delivered to the user.
Public Class Methods
Source
# File lib/controller.rb, line 12 def initialize @response = RackStep::Response.new @response.body = '' @response.content_type = 'application/json' @response.status = 200 end
Public Instance Methods
Source
# File lib/controller.rb, line 40 def after end
RackStep
will always execute this method after processing the request of to the specified controller. The user may overwrite this method. This can be used to check for logging or any piece of code that must be executed after every request for this controller. This may be usefull if the user wants to create an abstract controllers. TODO: Is this really necessary?
Source
# File lib/controller.rb, line 31 def before end
RackStep
will always execute this method before delegating the request processing to the specified controller. The user may overwrite this method. This may be usefull if the user wants to create an abstract controllers. TODO: Is this really necessary?
Source
# File lib/controller.rb, line 24 def process_request end
Once the application receives a new request, the router will decide wich controller should process that request and will execute this method for the chosen controller. So this is the most important method of this class and every controller should overwrite it to implement it’s business logic.