Physical path the public directory

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

RAILS_ROOT/public

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”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs