HABTM example required

You could do:

@customer = Customer.find_by_name("Joe Blogs")
@product = Product.find(1)
@customer.products << @product
@customer.save