Using label helper with HABTM checkboxes

I have a list of category checkboxes whose HTML looks like this:


…from…
check_box_tag(“categories[]”, cat[0], @post.categories.map {|c|
c.id}.include?(cat[0]))

I’d like the label to select the checkbox it’s associated with… but
all of the category names are “category[]”, so when I click any of the
labels they all toggle the first checkbox.

How can I code the label tag to associate the label with the checkbox?

Thanks,

SH

PS: Ideally I’d like my params[:categories] to look like [1, 3, 5, 8]