See also MagicFieldNames.
I’m looking for a Howto that would explain how to use ActsAsList where you have something like the following:
Book * id * name Category * id * name books_categories * book_id * category_id * position
The position in the books_categories table is relative to the category. Thus, under one category book A might be in position 4, while in another category it might be in position 1.
Suggested solution
Add a placeholder object and make that object act as a list.
E.g.
Book
|id|
|name|
has many :placeholdersCategory
|id|
|name|
has many :placeholdersPlaceholder
|id|
|position|
|book id|
belongs to :book
belongs to :category
acts as listcategories_placeholders
|placeholder id|
|category id|
I would suggest that this topic be renamed to HowToUseActsAsListWithHasAndBelongsToMany.
WikiGardening required. This How-to doesn’t explain how to actually use the relationships after it is setup. Additionally it doesn’t explain what happens to the books_categories table. Lastly, how would this work with a has-and-belongs-to-many relationship?