Topic: Working with migrations and associations
I've been tasked with putting together a new webapp from scratch: this seemed like a golden opportunity to pick up Rails, something I've been meaning to do for some time.
I'm quite comfortable with SQL, but I'd rather avoid it in this project --- it seems very un-Rails to write it raw.
Briefly, a target has a type, and a target may belong to any number of groups. target belongs_to type, type has_many targets, target belongs_to_many groups through membership, group has_many targets through membership. Right?
I'm at a loss as far as figuring out two things. One, how to put the above into pure migrations. Two, the proper Rails method to handle displaying the above. Ideally, I want users to add a target, have the option to associate with a type or create a new type, and then finally be able to add the target to any number of existing groups or create a new group.
The tutorials I've seen rely on, for lack of a better term, smoke and mirrors --- applications that are simple enough (single table, usually) to be handled by a default-arguments scaffold. Whenever I see association examples, I see copious amounts of SQL...which just feels wrong.
Am I simply looking in the wrong place?