I am trying to use the in_place_editor and update multiple ids on the
page based on the edits.
Here’s the example:
Want to let users edit the zip code using <%= in_place_editor_field
:customer, :zip, :script => true %> and when they complete the edit,
want to update one other id on the page that shows the customer city. I
have defined a method in the controller as -
def set_customer_zip
@customer = Customer.find(params[:id])
@customer.zip = params[:value]
@customer.city = “New City”
end
Here’s what I have tried so far
-
In set_customer_zip
render :text => @customer.zip
render :update do |page|
page.replace_html ‘customer_city’, @customer.city
end
Error: Two renders not allowed. -
In set_customer_zip
render :update do |page|
page.replace_html ‘customer_zip’, @customer.zip
page.replace_html ‘customer_city’, @customer.city
end
Problem: No syntax errors. Customer city gets updated and so does
customer zip, but customer zip no longer has the in-place edit
functionality
Any help is greatly appreciated. Thanks in advance.
Ray