Search code examples
ruby-on-railsrubybest-in-place

How to call child model controller by using best_in_place gem


I have a ActiveRecord::Base class Box that has_many Cards model.

There are some cards in box show.html.erb like this:

views/boxes/show.html.erb

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

I want to edit value by using best_in_place, but it send request to BoxesController not to CardsController and ends up with error AbstractController::ActionNotFound - The action 'update' could not be found for BoxesController:.

How can I specify a controller with best_in_place?


Solution

  • you can specify a path like this:

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