Displaying 3 results from an estimated 3 matches for "categories_post".
Did you mean:
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...
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-for...
2006 Feb 14
1
Another HABTM Question
...:action => ''index''
else
render :action => ''new''
end
end
I can successfully load all the categories into a multiple selection
box on the page that is creating the posting, but I''m unsure how to
save the posting.id and the category.id into the categories_postings
table within the ''create'' action.
Thank you,
Dave Hoefler
There really needs to be a ''Rails on Relationships'' book for us geeks ;-)