   setupController: ->
     @container.lookup('controller:repo').activate('index')
 
-Travis.AbstractBuildsRoute = Ember.Route.extend
+Travis.AbstractBuildsRoute = Ember.Route.extend Travis.DontSetupModelForControllerMixin,
   renderTemplate: ->
     @render 'builds', outlet: 'pane', into: 'repo'
 

Travis.PullRequestsRoute = Travis.AbstractBuildsRoute.extend(contentType: 'pull_requests')
Travis.BranchesRoute = Travis.AbstractBuildsRoute.extend(contentType: 'branches')

Travis.BuildRoute = Ember.Route.extend
  renderTemplate: ->
    @render 'build', outlet: 'pane', into: 'repo'


require 'travis/location'
require 'travis/line_number_parser'

Travis.DontSetupModelForControllerMixin = Ember.Mixin.create
  # I've override setup to *not* set controller's model
  # this can be remove when this patch will be merged https://github.com/emberjs/ember.js/pull/2044
  # this will allow us to override setting up model for a controller
  setup: (context) ->
    @redirected = false
    @_checkingRedirect = true

    @redirect(context)

    @_checkingRedirect = false
    if @redirected
      return false

    controller = @controllerFor(@routeName, context)

    @setupController(controller, context)
    @renderTemplate(controller, context);

Ember.Router.reopen
  location: (if testMode? then Ember.NoneLocation.create() else Travis.Location.create())
