The controller and action are defined in params
as params[:controller]
and params[:action]
, but there is no room for a "model" because the controller method can create many instances of models.
You might want to create some kind of helper method that will help you:
def request_controller params[:controller] end def request_action params[:action] end def request_model @request_model end def request_model=(value) @request_model = value end
You will need to explicitly install the model when it is loaded when serving the request:
@user = User.find(params[:id]) self.request_model = @user
tadman
source share