# How to get the path prefix?

**URL:** <https://www.ruby-forum.com/t/how-to-get-the-path-prefix/168562>\
**Category:** Rails\
**Created:** [May 22, 2009, 12:30pm UTC](https://www.ruby-forum.com/t/how-to-get-the-path-prefix/168562 "2009-05-22T12:30:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kittu.py](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f14d63/32.png) [@kittu.py](https://www.ruby-forum.com/u/kittu.py)\
**Post date:** [May 22, 2009, 12:30pm UTC](https://www.ruby-forum.com/t/how-to-get-the-path-prefix/168562/1 "2009-05-22T12:30:28Z")

</div>

Hi,

I started my rails application using mongrel with --prefix=/myapp;  
I have a javascript file where it makes an ajax call to ‘/get\_pics’;  
But this fails when I use --prefix option;

is there a method in rails which will return the path prefix (in this  
case its: myapp);  
so that I can assign it to a javascript variable ‘PATH’ in my layout  
and then make an ajax call to ( PATH + ‘/get\_pics’) ?

OR Is there any other way to solve this problem ?
