Ruby Pathname.to_path
In Rails code, you'll see a path constructed and returned as a string like this:
> Rails.root.join('app', 'models', 'my_path').to_s
=> "app/models/my_path"
An alternative method, that I think reads nicely, is to call to_path
:
Rails.root.join('app', 'models', 'my_path').to_path
=> "app/models/my_path"
Tweet