# Helper for root paths

**URL:** <https://www.ruby-forum.com/t/helper-for-root-paths/124128>\
**Category:** Rails\
**Created:** [December 25, 2007, 6:07am UTC](https://www.ruby-forum.com/t/helper-for-root-paths/124128 "2007-12-25T06:07:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [December 25, 2007, 6:07am UTC](https://www.ruby-forum.com/t/helper-for-root-paths/124128/1 "2007-12-25T06:07:24Z")

</div>

i’m not sure what to do when my production environment is not in the  
root path of the domain when it comes to including things like flash  
files.

when testing, everything works great, but since i don’t have a helper  
like image\_tag, i have to change the url of the flash file each time i  
test and then change it back when i deploy the changes.

is there a helper in rails that will just add the root prefix to urls  
based on the environment?

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [December 25, 2007, 5:01pm UTC](https://www.ruby-forum.com/t/helper-for-root-paths/124128/2 "2007-12-25T17:01:15Z")

</div>

On Dec 24, 9:06 pm, Josh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> is there a helper in rails that will just add the root prefix to urls  
> based on the environment?

If there isn’t, I think you just wrote one. 🙂

///ark

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [December 25, 2007, 6:01pm UTC](https://www.ruby-forum.com/t/helper-for-root-paths/124128/3 "2007-12-25T18:01:03Z")

</div>

Josh K. wrote:

> i’m not sure what to do when my production environment is not in the  
> root path of the domain when it comes to including things like flash  
> files.
> 
> when testing, everything works great, but since i don’t have a helper  
> like image\_tag, i have to change the url of the flash file each time i  
> test and then change it back when i deploy the changes.
> 
> is there a helper in rails that will just add the root prefix to urls  
> based on the environment?

you can play around w the different environment files (  
environments/development.rb | production.rb | test.rb ) and play around  
with either

self.document\_root = “/some/path”  
or the  
RAILS\_ROOT constant (also, a “some/path/” string)

nothing here is tested, but i hope this leads to some new info or helps  
out digging a little further

good luck!  
shai
