method
root
![Moderate documentation Importance_2](https://d2vfyqvduarcvs.cloudfront.net/images/importance_2.png?1349367920)
root()
public
Register or
log in
to add new notes.
ronald -
June 4, 2009
szeryf -
February 25, 2010
![Default_avatar_30](https://www.gravatar.com/avatar/83da11bf035086a765af8d2e5777e954?default=http://apidock.com/images/default_avatar_30.png&size=30)
2 thanks
![Default_avatar_30](https://www.gravatar.com/avatar/024f6d59fd34ceca04f3fc18a87bdb98?default=http://apidock.com/images/default_avatar_30.png&size=30)
2 thanks
Possible gotcha
This method returns a Pathname object which handles paths starting with a / as absolute (starting from the root of the filesystem). Compare:
>> Rails.root => #<Pathname:/some/path/to/project> >> Rails.root + "file" => #<Pathname:/some/path/to/project/file> >> Rails.root + "/file" => #<Pathname:/file> >> Rails.root.join "file" => #<Pathname:/some/path/to/project/file> >> Rails.root.join "/file" => #<Pathname:/file>