diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-05-07 19:09:20 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-05-07 19:09:20 -0300 |
commit | 6d951bda36c60d3d377ef63b22a855fbd2735df3 (patch) | |
tree | 496f6e1aa4a87a4051b4dc4cee73f5d90fb233c4 | |
parent | d19d79e6bb24aa5d0d7b040f018bd42f0d474f3c (diff) | |
parent | b0b4b176b0e061a4f03ddce669637b7d6c37aa33 (diff) | |
download | rails-6d951bda36c60d3d377ef63b22a855fbd2735df3.tar.gz rails-6d951bda36c60d3d377ef63b22a855fbd2735df3.tar.bz2 rails-6d951bda36c60d3d377ef63b22a855fbd2735df3.zip |
Merge pull request #20063 from trayo/master
Adds documentaion for the Rails.root and Rails.public_path methods
-rw-r--r-- | railties/lib/rails.rb | 10 |
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 |