search for: categories_posts

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

2006 Jul 12
1
odd habtm behavior? or is it me?
...ies assigned ( empty @params[''post''][''categories''] ) then a save is sucessful for both new and found Posts. 2) if a new Post has a category then save is successful but the categories are not associated with the created object, but this sql is logged: INSERT INTO categories_posts ("post_id", "id", "category_id") VALUES (0,1,1) - I have also tried: Post.create(@params[''post'']).category_ids = @params[''post''][''categories''] # without the prep above and with attr_protected :categories 3) if a P...
2006 Apr 06
3
has_and_belongs_to_many find
Say I have a post model that has_and_belongs_to_many :categories, and a category model that has_and_belongs_to_many :posts. So I have a categories_posts table to do the join. That''s all find and dandy. However I want to be able to find all the posts that belong to a specific category. I tried Post.find_by_category(:id) but that doesn''t work. Does anyone have any insight? Thanks in advance. -- Posted via http://www.ruby-foru...
2006 Feb 14
1
Another HABTM Question
Hi there, I have a question on what would be the best way to save a HABTM model. A posting habtm categories, and a category habtm postings. class Category < ActiveRecord::Base has_and_belongs_to_many :postings end class Posting < ActiveRecord::Base has_and_belongs_to_many :categories end In my blog_controller, where the actual posting is saved, is where I think I''m