Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the Rails.root equivalent in a Rack application?

Tags:

rack

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.

like image 393
Zack Xu Avatar asked Apr 03 '14 10:04

Zack Xu


1 Answers

This returns the root directory in a string.

Rack::Directory.new('').root

Not sure if there's a better, shorter syntax.

like image 96
Zack Xu Avatar answered Oct 29 '22 17:10

Zack Xu