web design services singapore,singapore app developer,web design singapore,ios app development singapore,website design singapore,website development singapore,mobile app developer singapore,singapore mobile application developer,web designer singapore,web application singapore,singapore web design,mobile app development singapore,singapore web development,website developer singapore,graphic designer in singapore,web design company singapore,mobile apps singapore,singapore web design services,mobile apps development singapore,singapore mobile app developer,mobile application development singapore,developer in singapore,android developer singapore,mobile game developer singapore,mobile developer singapore,web development company singapore,app development singapore,app developer singapore,developers in singapore,mobile application developer singapore,website designer singapore,ruby on rails developer singapore,design agency singapore,singapore website design,ios developer singapore,design firms in singapore,web development singapore

Ruby on Rails – Anatomy of a Request object

Display current url without base url

<%= request.request_uri %> / <%= request.path%>
eg: /vinova/development/web_and_iphone_apps

Display previous url with base url

<%= request.referer %>
eg: http://www.vinova.sg/development/web_and_iphone_apps

Display base url

<%= request.env[‘HTTP_HOST’]%>
eg: www.vinova.sg

Display protocol

<%= request.env[‘SERVER_PROTOCOL’]%>
eg: HTTP/1.1

Full url

<%= request.url%>
eg: http://www.vinova.sg/development/web_and_iphone_apps

Display how many parameters found in current url

<%= request.query_parameters.size %>

url eg: www.vinova.sg/index.html?key=3&d=4
answer: 2 => (2 parameters)

Display controller name from current url

<%= request.path_parameters[‘controller’] %>
eg: contents

Display action name from current url

<%= request.path_parameters[‘action’] %>
eg: login

Everything inside a request

<%= request.inspect%>

%d bloggers like this:
WordPress