a myftical journeythrough the
RUBY ON RAILS.
Request Cycleof
AN
ORATIONIN
TWO PARTS
BY L.C.
principle
info passed via arguments
return value ignoredvia objects
Dispatcher
dispatch(cgi, session_options, output)
Delegate to Controller.
controller_class.process(request,response)
Handle errors.
rescue Exception => exception end
begin
view
dispatcher
controller
boom!
Handle errors.
controller_class.process_with_exception(request,response,exception)
rescue Exception => exception
end
end
Handle errors.
controller_class.process_with_exception(request,response,exception)
rescue Exception => exception
failsafe_response(output, '500 Internal Server Error', exception) do
end
end
Tidy up.
Dependencies
production# no-op
otherwiseframework tidy-up hooks
ActiveRecord
ActionController
process(request,response,method, *args)
Setup instance.
Set up the magic to make youractions sing!
Setup instance.
handy accessors
from request:
requestparamscookies
from response:responsetemplatesessionheaders
Dispatch action.
instance method(and, render if you haven't).
Dispatch action.
method missing(and, render if you haven't).
-or-
Render.
@assigns = instance_vars - protected_vars
5 minute talk subject:
How we chooseyour viewfor you.
html
How we chooseyour viewfor you.
rjs
json xml
file
action
template
text
layout
nothing