module Rad::Router::CoreRoutingHelper inject router: :router delegate :url_for, :url_for_path, :persist_params, :persist_params?, :dont_persist_params, to: :router def default_path options = {} url_for_path rad.router.default_path, options.merge(url_root: false) end def return_to_path options = {} dont_persist_params do path = params[:_return_to] || workspace.request.session['return_to'] || rad.router.default_path url_for_path path, options.merge(url_root: false) end end def parse_routing_arguments *args params = args.extract_options! raise "invalid usage!" unless args.size <= 1 if args.size == 1 raise "duplicate :id pameter!" if params.include?(:id) or params.include?('id') params[:id] = args.first.to_param end params end protected def method_missing m, *args, &block m = m.to_s if m =~ /path$/ params = parse_routing_arguments(*args) klass, method = router.encode_method m, params.include?(:id) url_for klass, method, params else super m.to_sym, *args, &block end end end