Hi,
New to RoR and I just wanted to check the correct process flow for
this...
I presently have a controller action:
def destroy_category_association
category = CatalogueCategory.find(params[:id])
product = Product.find(params[:product_id])
product.catalogue_categories.delete(category)
end
I display a list of categories assigned to a product, some of which I
may wish to delete using the link below. The list of categories is
stored in a <div
id="associated_categories"><ul><li>...</li></div>
structure.
<%= link_to_remote("Remove Association", :complete => "new
Effect.Fade(''cat#{associated_category.id}'')",
:url => { :action => :destroy_category_association,
:id => associated_category.id,
:params => {:product_id => product_id}},
:confirm => "Are you sure?") %>
Presently removing an item works correctly, including a Prototype based
Fade effect on the deleted item. However, I am concerned that the
destroy_category_association action does not render output, a fact I am
reminded of in the logs. This isn''t an issue for adding to the list as
I
call a render method to insert the partial for the new record.
When deleting should I pass back the entire list of categories minus the
removed item via a render call? Something along the lines of...
render(:partial => "associated_category", :object => categories,
:locals
=> { :product_id => product.id }, :layout => false)
If so how would I handle the Fade effect on the newly deleted item?
Any pointers as to the correct way to achieve this are much appreciated.
Andrew.
--
Posted via http://www.ruby-forum.com/.