Merge pull request #20063 from trayo/master

Adds documentaion for the Rails.root and Rails.public_path methods
This commit is contained in:
Rafael Mendonça França 2015-05-07 19:09:20 -03:00
commit 6d951bda36

@ -52,6 +52,11 @@ def backtrace_cleaner
end
end
# Returns a Pathname object of the current rails project,
# otherwise it returns nil if there is no project:
#
# Rails.root
# # => #<Pathname:/Users/someuser/some/path/project>
def root
application && application.config.root
end
@ -94,6 +99,11 @@ def groups(*groups)
groups
end
# Returns a Pathname object of the public folder of the current
# rails project, otherwise it returns nil if there is no project:
#
# Rails.public_path
# # => #<Pathname:/Users/someuser/some/path/project/public>
def public_path
application && Pathname.new(application.paths["public"].first)
end