request.fullpath gives the fullpath plus any parameter passed, such as
/page?param1=value¶m2&value
How can I get just the page with no params? Like
/page
Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use
pathinstead offullpath.Although not documented,
request.pathworked 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], whererequest.pathis defined”.pathis not documented there, but the source displays script_name + path_info.