Displaying 2 results from an estimated 2 matches for "catalogue_categori".
Did you mean:
catalogue_category
2006 Jun 14
3
Prevent duplicate HABTM associations
...understand I could use :uniq=>true on the model association but this
would only prevent it from displaying duplicates, I want to stop
duplicate associations being inserted in the first place.
I have a vague idea of something using a callback to check before
adding.
has_and_belongs_to_many :catalogue_categories, :before_add =>
:evaluate_duplicate_category
def evaluate_duplicate_category(catalogue_category)
#check duplicate
#if so raise error and abort add
end
However I am unsure how to abort the add at this stage and return an
error. Could anyone help point me in the right direction?
Tha...
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_categories"><ul><li>...</li></div>
structure.
<%= link_to_r...