search for: cataloguecategory

Displaying 2 results from an estimated 2 matches for "cataloguecategory".

2010 Feb 16
0
as_json and self-referential associations
...ing the new(?) as_json methods within a rest api I am working on. However I am not sure how you are supposed to, or whether it is designed to handle multiple variations of association inclusion. For example I have a model using acts_as_tree, so that each instance has children and a parent: class CatalogueCategory < ActiveRecord::Base acts_as_tree JSON_ATTRS = [''id'', ''name'', ''description'', ''slug''] def as_json(options=nil) attributes.slice(*JSON_ATTRS).merge(:children => children, :ancestors => ancestors) end end...
2006 Jun 13
1
AJAX based record deletion
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...