aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorTravis Yoder <trayoda@gmail.com>2015-05-07 10:54:26 -0600
committerTravis Yoder <trayoda@gmail.com>2015-05-07 10:54:26 -0600
commitb0b4b176b0e061a4f03ddce669637b7d6c37aa33 (patch)
treedec97a2775d1d429d30fc7ccc07c3d3352f501ca /railties
parent5a06bbc712713c94766fd3acd18defde51c94da8 (diff)
downloadrails-b0b4b176b0e061a4f03ddce669637b7d6c37aa33.tar.gz
rails-b0b4b176b0e061a4f03ddce669637b7d6c37aa33.tar.bz2
rails-b0b4b176b0e061a4f03ddce669637b7d6c37aa33.zip
better docs for Rails.root and Rails.public_path
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb
index b1f7c29b5a..fe789f3c2a 100644
--- a/railties/lib/rails.rb
+++ b/railties/lib/rails.rb
@@ -52,6 +52,11 @@ module Rails
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 @@ module Rails
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