Problem in Routing and associations

Hello, I am new to Ruby on Rails and i am stuck on this problem.

I have two models products and categories. I have scaffolded both the
models with the basic attributes and i am using has_many through
associations. Now, i want to add categories for a product, so i have
made an action select-categories for that which displays check boxes
and does the saving part. I have done this much.

Now i want to use the above saved categories for the given product and
assign them priorities, so once i have saved the categories for a
given product, i want to show the priority_assign view and that too
showing the saved categories for the given product and the product id.

help me out.