Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhanced Rails.root to take parameters that'll be join with the root,…
… like Rails.root('app', 'controllers') => File.join(Rails.root, 'app', 'controllers') [#1482 state:committed] (Damian Janowski)
- Loading branch information
Showing
3 changed files
with
14 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fdfcdf4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather make
Rails.root
returnPathname(RAILS_ROOT)
to allow for this instead:Rails.root.join('app', 'controllers')
. Makes more sense and reads better.fdfcdf4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what’s the purpose of calling *args.compact?
if you have code like Rails.root(“app”, @subdirectory),
it feels like it should raise an exception if that ends up being nil,
rather than silently failing.
fdfcdf4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for the question about
*args.compact
.fdfcdf4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My original patch didn’t include the call to `#compact` and I agree it should be avoided. My comments here http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1482-allow-railsroot-to-take-arguments-to-build-a-path-with-filejoin#ticket-1482-5