From c275f43147e7a8ab54623bdc5b9a8124b8592330 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 22 Apr 2014 14:39:43 +0200 Subject: return nil as auto_ticket_path for invalid tickets The auto_ticket_path is referenced from the tickets_controller like this: respond_with(@ticket, :location => auto_ticket_path(@ticket)) While this only uses the location parameter when the ticket is valid it will still attampt to calculate it if not. During the create action this will lead to crashes because the ticket_path can not be calculated for a ticket without an id. This led to https://leap.se/code/issues/5552 and probably https://leap.se/code/issues/5545. --- engines/support/app/helpers/auto_tickets_path_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/support/app/helpers/auto_tickets_path_helper.rb b/engines/support/app/helpers/auto_tickets_path_helper.rb index 93f3cb9..5638222 100644 --- a/engines/support/app/helpers/auto_tickets_path_helper.rb +++ b/engines/support/app/helpers/auto_tickets_path_helper.rb @@ -23,6 +23,7 @@ module AutoTicketsPathHelper end def auto_ticket_path(ticket, options={}) + return unless ticket.persisted? options = ticket_view_options.merge options if @user user_ticket_path(@user, ticket, options) @@ -50,4 +51,4 @@ module AutoTicketsPathHelper hsh end -end \ No newline at end of file +end -- cgit v1.2.3