Displaying 1 result from an estimated 1 matches for "paintings_themes".
2006 May 22
4
use join table in paginate
...ith a n:m relationship (in a database, that is) and its
join table.
Here are my objects:
class Painting
has_and_belongs_to_many :themes
which maps to db entity
painting
id
class Theme
has_and_belongs_to_many :paintings
which maps to db entity
theme
id
And of course the join table
paintings_themes
painting_id
theme_id
So, paintings have one or more themes, and a theme can belong to more
paintings.
In my ExpositionController, which shows the paintings, I have:
@painting_pages, @paintings = paginate :paintings, :per_page => 10
But now I want only to show paintings with a certai...