Help with modelling ActiveRecord associations

I have been messing about with Rails and ActiveRecord for a while now, and I have had great success in the simple cases. But I have hit a stumbling block when it came to modelling a non-trivial problem domain.

I had hoped to absorb the knowledge by example, but fundamentally I don't grok the more sophisticated associations and more importantly when to use them.

My background isn't in DB designs. I went looking for something that could help me with the design related stuff from an ActiveRecord perspective (i.e. I know what I want my objects to look like and behave in terms of their associations, but how do I model that in the database).

Anyone know of any domain modelling resources with an ActiveRecord flavour? Preferably example heavy.

I suspect that I need to get down and dirty with HABTM, or has_many through, but I don't know when I need to use them.

If its any use, the problem I am trying to model is as follows. Its a software & hardware inventory system, services run on regular PCs but have a relationship with hardware devices. All are network accessible, but the hardware devices can have a relationship with hundreds of services, while the services can have a relationship with at most 6 hardware devices (domain specific constraints).

any help at all would be appreciated.

regards, Richard.