In the Models you define that Catagory
has_many :images
and Image
belongs_to :category
- image should have category_id member of course
Then , when you have category object in hand (let's say @cat), you simply iterate @cat.images
You can read more about Models and Relation in here