I'm familiar with the Rails.root
in Rails which tells you the directory of your current application. This is quite handy sometimes.
Now I'm developing a Rack application (on which Rails is based). How do I find out the Rails.root
equivalent for a Rack application?
Thank you.
This returns the root directory in a string.
Rack::Directory.new('').root
Not sure if there's a better, shorter syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With