wrong location in respond_with multiple object

65 views Asked by At

I have to pass 2 objects to show so I tried to put this

respond_with(@ticketnfr, @ticket)

but it goes to ticket controller view,

when I tried with only one object

respond_with(@ticketnfr)

it goes correctly to ticketnfr/show, but I miss the ticket params,

I also tried to put the location

respond_with(@ticketnfr, @ticket. :location => ticketnfr_path)

but it goes to the index instead of show

how to pass both of the objects but still going to the ticketnfr/show?

2

There are 2 answers

2
kwaigon On

Try this one:

@response = {:ticket => @ticket, :ticketnfr => @ticketnfr}
respond_with(@response)
0
alfitra On

i have create the respond_with like this

respond_with(@ticketnfr, :location => ticketnfr_url(:id => @ticketnfr.id, :ticket_id => @ticket.id))

Thank You