Pathnames using division in Ruby
This will probably seem like a common pattern to you:
Rails.root.join("spec/support")
or
Rails.root.join("spec", "support")
Did you know that the division operator on Pathname
is aliased to the addition operator? So you can do this:
Rails.root / "app" / "views"
I know it will probably frazzle a bunch of people, but I kinda love it.
Tweet