Ever tried Rails.root

Published on Author Akhil BansalLeave a comment

Guys, have you ever tried Rails.root. It gives same value as RAILS_ROOT. But now in edge rails it is modified and you can do much more with it.

You can use Rails.root at places like:

 File.join(RAILS_ROOT, 'public', 'images')


 Rails.root.join('public', 'images')

Both gives the same result.


Leave a Reply

Your email address will not be published. Required fields are marked *