开发者

What is the appropriate "respond_with" to put in the "update" action of a nested resource controller?

And it is being accessed via js.

I have my "respond_to :html, :js" line in my controller.

However, in my update action:

if @permission.update_attributes(params[:permission])
  respond_with [@brand,@permission]
end

Tries to go to the "show" method. When I just have:

@permission.update_attributes(params[:permission])

Then my update.js.erb is accessed appropriately.

I don't understand the deal here, can anyone help? I feel like I should have that "respond_with" line in there, though I don't开发者_如何学编程 really know why if it is working.


You want to do:

def update
    @brand = ....
    @permission = ....
    @permission.update_attributes(params[:permission])
    respond_with [@brand, @permission]
end

Read more here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜