AREL changes break existing routes.

https://rails.lighthouseapp.com/projects/8994/tickets/6045-rails-303-gives-completed-406-not-acceptable

I have reported this but have seen no action. Since the problem is preventing us upgrading past Rails-3.0.1 I would like to have some attention given to it or some form of workaround found. I have been unable to find one myself.

The difficulty is easily reproduced and apparently hinges on the interaction of a singular and plural form of the same resource. Given an otherwise unmodified Rails3 project and a routes file that contains only this:

  resource :seat do     resources :tickets   end

  resources :seats do     resources :tickets,       :controller => 'seat_tickets'   end

Then in 3.0.3 seat_tickets_path( 1 ) produces this uri:

  app.seat_tickets_path( 1 ) => "/seat/tickets.1"

While the routing provided works as expected in 3.0.1:

  app.seat_tickets_path( 1 ) => "/seats/1/tickets"

It seems to me that something is seriously awry with AREL if asking for a resource by id generates a request for a nonsensical format.

I have reported this but have seen no action. Since the problem is preventing us upgrading past Rails-3.0.1 I would like to have some attention given to it or some form of workaround found. I have been unable to find one myself.

The difficulty is easily reproduced and apparently hinges on the interaction of a singular and plural form of the same resource. Given an otherwise unmodified Rails3 project and a routes file that contains only this:

resource :seat do resources :tickets end

resources :seats do resources :tickets, :controller => 'seat_tickets' end

Then in 3.0.3 seat_tickets_path( 1 ) produces this uri:

app.seat_tickets_path( 1 ) => "/seat/tickets.1"

While the routing provided works as expected in 3.0.1:

app.seat_tickets_path( 1 ) => "/seats/1/tickets"

It seems to me that something is seriously awry with AREL if asking for a resource by id generates a request for a nonsensical format.

This actually has nothing to do with arel, the issue is that the named routes you have clash , the /seat/tickets and /seat/1/tickets are *both* called seat_tickets_path.

The fact it was 'working' before was actually a bug, the priority is *meant* to be given to the first routes you have declared, your application expects it to be given to the second. I believe you might be able to work around this by using the hash arguments instead of positional arguments:

seat_tickets_path(:id=>1)

But the reality is that your named routes are clashing and you're going to have various random bits of fucked up results unless you address that. If you never use /seat/tickets.:format you could use resources :tickets, :only => [:things, :you, :use] to avoid it.