Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

request.fullpath with no parameters

request.fullpath gives the fullpath plus any parameter passed, such as

/page?param1=value&param2&value 

How can I get just the page with no params? Like

/page 

Thank you.

like image 403
Martin Avatar asked Mar 10 '11 21:03

Martin


1 Answers

Use path instead of fullpath.

Although not documented, request.path worked for me. I usually use my plugin rails_web_console for playing with the request object.

Update:

As noticed by turboladen, "[ActionDispatch::Request][2] inherits from [Rack::Request‌][3]​, where request.path is defined".

path is not documented there, but the source displays script_name + path_info.

like image 150
rosenfeld Avatar answered Oct 02 '22 11:10

rosenfeld