       uid: id
     sensor.fetch()
 
-    showView = new Workbench.Views.SensorShowView
+    @showView = new Workbench.Views.SensorShowView
       model: sensor
       el: $("#sensorView")
-    showView.renderBasic()
+    @showView.renderBasic()

  index: ->
    console.log "loading index route"

    if (location.search.length < 1)
      @navigate "sensors?api_key=#{@apiKey}", { replace: true }

    sensors = new Workbench.Collections.SensorsCollection
      source: Workbench.source

    indexView = new Workbench.Views.SensorIndexView
      collection: sensors
      el: $("#apiView")

    indexView.render()
    sensors.fetch()

  show: (id) ->
    console.log "loading show route", id
    if id is "demo"
      # Demo user
      id = "f9b0b42d4b742638f96dfea960ef4735"

    @listenTo Workbench.Events, "redirectToSensor", (sensor) =>
      @navigate "sensors/#{sensor.id}", { trigger: true }

  cleanupViews: ->
    if @indexView
      @indexView.remove()
      delete @indexView

    if @showView
      @showView.remove()
      delete @showView

  getApiKey: ->
    if (location.search.length < 1)
      # Demo user read-only key
