How does Rails handle many to many relationships?

I’m trying to show a relationship for a user having many tasks. I’ve noticed the :has_many statement in Rails am not sure what “automagic” that creates for you. In .NET, for instance, I would create a bridge table that would link user_id to task_id and run queries off of that. For Rails, I get a feeling some of this is done for you by using :has_many. Can anyone explain some of this to me? Or am I crazy and I must build some bridge table and run queries against it?

you need to create a task_user table with columns task_id and user_id

after the associations are set in the models, rails knows how to get the objects without querying the bridge table. for example, by calling directly @
user.tasks is possible

And just leave the “id” columns as defaults for the task and user table?