Module: Rory::PathGeneration
- Included in:
- Controller, Renderer::Context
- Defined in:
- lib/rory/path_generation.rb
Instance Method Summary collapse
Instance Method Details
#path_to(route_name, fields = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/rory/path_generation.rb', line 3 def path_to(route_name, fields = {}) if route = @app.routes.detect { |r| r.name == route_name } path = route.mask.dup.prepend('/').prepend(base_path.to_s) fields.each do |key, value| path.gsub!(/\:#{key}/, value.to_s) end path end end |