如何使用best_in_place gem调用子模型控制器

时间:2015-01-02 11:12:54

标签: ruby-on-rails ruby best-in-place

我有一个ActiveRecord::BaseBox has_many Card型号。

show.html.erb中有一些卡片如下:

视图/盒/ show.html.erb

...
<% @cards.each do |card| %>
<%= best_in_place card, :front %>
<% end %>
...

我想使用best_in_place来修改价值,但它会向BoxesController发送请求,而不是CardsController,最后会收到错误AbstractController::ActionNotFound - The action 'update' could not be found for BoxesController:

如何使用best_in_place指定控制器?

1 个答案:

答案 0 :(得分:0)

你可以指定这样的路径:

<%= best_in_place detail, :price, :display_as => :mk_bal, :classes => 'price_bind', :path => purchase_detail_path(@purchase, detail)%>