简体   繁体   English

response_with多个对象中的错误位置

[英]wrong location in respond_with multiple object

I have to pass 2 objects to show so I tried to put this 我必须通过2个对象来显示所以我试图把它

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, 它正确到了ticketnfr / show,但是我错过了票证,

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? 如何传递两个对象,但仍然要去ticketnfr / show?

Try this one: 试试这个:

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

i have create the respond_with like this 我已经像这样创建了respond_with

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

Thank You 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM