Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

Specify createTrailingSlashRoutes as an instance property when extending from Backbone.Subroute #56

Description

@aeksco

I'm in a situation where I have the following:

class App.Routers.SuperRouter extends Backbone.SubRoute
  createTrailingSlashRoutes: true
  ...

from which I extend:

class App.Routers.Books extends App.Routers.SuperRouter
  ...

I've noticed that the createTrailingSlashRoutes: true instance property is applied to neither App.Routers.SuperRouter nor the routers extending from it. This appears to be the result of backbone.subroute.js line 38:

this.createTrailingSlashRoutes = options && options.createTrailingSlashRoutes;

indicating that the createTrailingSlashRoutes option must be supplied to the router when it's instantiated. It looks like this would be a simple change:

this.createTrailingSlashRoutes ||= options && options.createTrailingSlashRoutes;

and I would like to know wether this is worth doing before I go through the process of throwing together a PR. For the time being I am supplying my own constructor:

class App.Routers.SuperRouter extends Backbone.SubRoute
  constructor: (route, opts = {}) ->
    super(route, _.extend opts, { createTrailingSlashRoutes: true })
  ...

Let me know your thoughts when you've got a moment - thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions