Setting association values via id or objects

Hi there,

I've got a question about best practice/preferred method of setting up
an association. I have a User model which has and belongs to many
interests.

From playing about with the console I know I can go..

interests = Interests.find([1,2,3,4])
user = User.new(:interests=>interests)
...or...
user = User.new(:interest_ids=>[1,2,3,4,5])

and similarly on existing objects

user.interest_ids = [1,2,3,4]
or user.interests = [interest_obj_a, interest_obj_b, interest_obj_c)

My question is, is there a functional difference between the two, or
can one freely interchange between setting relations via id or via
literal objects?

Thanks,

Gavin.

There is no difference in the results, where there might be a difference
is in how many calls to the database each takes. Do which ever is more
straight forward to start, however. By the time it makes a performance
difference you may have ditched the HABTM relationship for something
saner anyway.