search for: categories_item

Displaying 3 results from an estimated 3 matches for "categories_item".

Did you mean: categories_items
2006 May 05
4
STI and HABTM
...For instance...let''s say I have the following models ----- Category < ActiveRecord::Base Item < ActiveRecord::Base Product < Item Deal < Item ----- Each product or deal can have categories. Would I then setup Item with has_and_belongs_to_many :categories, then create a table categories_items ??? Is there a better way to do it? Haven''t done this with STI yet - Thanks. -- seth at subimage interactive http://www.subimage.com/sublog/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060505...
2005 Jun 13
1
Question on Eager Associations
Hi - I am trying to use eager associations to cut down on database queries. I have a feeds table, an items table, a categories table, and a categories_items table. feeds have items, and items have many categories (and categories can be assigned to many items), thus the categories_items table which is a many-many join table. I do @feed = Feed.find(1) which works fine, but now I want to use eager associations to decrease the queries needed. So I tr...
2006 Jan 04
2
Updating Attributes in a HABTM Join Table
Is there a way to update attributes in a HABTM join table? Right now I am deleting the join and then recreating it with new attributes. I have a table "categories" and another table "items". They are both HABTM with the join table "categories_items" between them. If an item is joined to a category once, no problem, we create the join. But if an item is joined to a category more than once, I want to record the subsequent hit in a field called "cat_count" which exists in the join table. def add_category( category_id_as...