Module: Merb::Slices::Support
- Defined in:
- lib/merb-slices/controller_mixin.rb
Instance Method Summary collapse
-
#slice_url(slice_name, *args) ⇒ String
Generate a slice url - takes the slice’s :path_prefix into account.
Instance Method Details
#slice_url(slice_name, *args) ⇒ String
Generate a slice url - takes the slice’s :path_prefix into account.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/merb-slices/controller_mixin.rb', line 25 def slice_url(slice_name, *args) opts = args.last.is_a?(Hash) ? args.pop : {} route_name = args[0].is_a?(Symbol) ? args.shift : :default routes = Merb::Slices.named_routes[slice_name] unless routes && route = routes[route_name] raise Merb::Router::GenerationError, "Named route not found: #{route_name}" end args.push(opts) route.generate(args, params) end |