if (Handlebars) {
  Handlebars.registerHelper('pathFor', function (routeName, context, options) {

    if (arguments.length == 2) {
      options = context;
      context = this;
    }

    var params = this;
    var hash = options.hash.hash;
    var query = _.omit(options.hash, 'hash');

    return Router.path(routeName, params, {
      query: query,
      hash: hash
    });
  });

  Handlebars.registerHelper('urlFor', function (routeName, context, options) {
    if (arguments.length == 2) {
      options = context;
      context = this;
    }
    var params = this;
    var hash = options.hash.hash;
    var query = _.omit(options.hash, 'hash');
    return Router.url(routeName, params, {
      query: query,
      hash: hash
    });
  });

  Handlebars.registerHelper('renderRouter', function (options) {
    return new Handlebars.SafeString(Router.render());
  });

  Handlebars.registerHelper('currentRouteController', function () {
    return Router.current();
  });
}

if (Handlebars) {
  Handlebars.registerHelper('pathFor', function (routeName, params, options) {

    if (arguments.length == 2) {
      options = params;
      params = this;
    }

    var hash = options.hash.hash;
    var query = _.omit(options.hash, 'hash');

    return Router.path(routeName, params, {
      query: query,
      hash: hash
    });
  });

  Handlebars.registerHelper('urlFor', function (routeName, params, options) {
    if (arguments.length == 2) {
      options = params;
      params = this;
    }

    var hash = options.hash.hash;
    var query = _.omit(options.hash, 'hash');

    return Router.url(routeName, params, {
      query: query,
      hash: hash
    });
  });

  Handlebars.registerHelper('renderRouter', function (options) {
    return new Handlebars.SafeString(Router.render());
  });

  Handlebars.registerHelper('currentRouteController', function () {
    return Router.current();
  });
}

Fix Handlebars helper pathFor and urlFor params bug.
Fix Handlebars helper pathFor and urlFor params bug.

You can optionally pass a parameters object as the first parameter. By default
these helpers will use the current data context for the parameters object.
