Generate a slice url - takes the slice’s :path_prefix into account.
@param slice_name
The name of the slice - in identifier_sym format (underscored).
@param *args
There are several possibilities regarding arguments: * when passing a Hash only, the :default route of the current slice will be used * when a Symbol is passed, it's used as the route name * a Hash with additional params can optionally be passed
@return
@example slice_url(:awesome, :format => ‘html’) @example slice_url(:forum, :posts, :format => ‘xml’)
# File lib/merb-slices/controller_mixin.rb, line 25 25: def slice_url(slice_name, *args) 26: opts = args.last.is_a?(Hash) ? args.pop : {} 27: route_name = args[0].is_a?(Symbol) ? args.shift : :default 28: 29: routes = Merb::Slices.named_routes[slice_name] 30: unless routes && route = routes[route_name] 31: raise Merb::Router::GenerationError, "Named route not found: #{route_name}" 32: end 33: 34: args.push(opts) 35: route.generate(args, params) 36: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.