Does anyone know if it is possible (and, if so, what the syntax is) for using a nested resource with the best_in_place gem?
My routes.rb looks something like this
resources :users do
resources :goals
end
I would like to edit the :description
field of the goal, but the code in my view for
<%= best_in_place [@user, @goal], :description %>
gives a NoMethodError saying
undefined method `description' for #<Array:0x20e0d28>
Using
<%= best_in_place @goal, :description %>
give me an undefined method error also because there is no goal_path
I can get the gem to work for @user (the non nested resource) field without problems.
I'm running Rails 3.1.1, Ruby 1.9.2, best_in_place 1.0.4
I figured it out.
I needed to set the path
option in the call like so
<%= best_in_place @goal, :description, :path => user_goal_path %>
It works like a champ now!
Add path and the objects to the path:
<%= best_in_place @goal, :description, :path => user_goal_path(@user,@goal) %>
Somehow the simple path solution of bknoles didn't work for me.
Now above method is deprecated.
According to latest Documentation use ":url" instead of ":path" like below in the example
<%= best_in_place @goal, :description, :url => user_goal_path %>
Cheers!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With