   show: (id) ->
     console.log "loading show route", id
     @cleanupViews()
+    @addApiKeyParam("sensors/#{id}")
 
     if id is "demo"
       # Demo user

      params = $.deparam(location.search.split('?')[1])
      @apiKey ||= params.api_key

  index: ->
    console.log "loading index route"
    @cleanupViews()
    @addApiKeyParam()

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

      @navigate "sensors/#{sensor.id}", { trigger: true }

  # Ensure the API Key is displayed in the URL params.
  addApiKeyParam: (base) ->
    if (location.search.length < 1)
      @navigate "#{base}?api_key=#{@apiKey}", { replace: true }

  cleanupViews: ->
    if @indexView
