# Physical path the public directory

**URL:** <https://www.ruby-forum.com/t/physical-path-the-public-directory/113688>\
**Category:** Rails\
**Created:** [September 3, 2007, 11:20pm UTC](https://www.ruby-forum.com/t/physical-path-the-public-directory/113688 "2007-09-03T23:20:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [September 3, 2007, 11:20pm UTC](https://www.ruby-forum.com/t/physical-path-the-public-directory/113688/1 "2007-09-03T23:20:20Z")

</div>

How, from my controller, can I get the filesystem path to my rails  
app’s ‘public directory’? e.g.:

/users/eggie5/sites/rails\_app/public

---

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [September 3, 2007, 11:49pm UTC](https://www.ruby-forum.com/t/physical-path-the-public-directory/113688/2 "2007-09-03T23:49:22Z")

</div>

RAILS\_ROOT/public

---

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [September 4, 2007, 12:02am UTC](https://www.ruby-forum.com/t/physical-path-the-public-directory/113688/3 "2007-09-04T00:02:23Z")

</div>

Sometimes I want/need an absolute path, so I add this to my config/  
environment.rb

RAILS\_FULL\_ROOT = Pathname.new(RAILS\_ROOT).realpath.to\_s  
the public directory is then  
public = “#{RAILS\_FULL\_ROOT}/public”
