Dirk Bergmann

Developer, panographer. Does consultancy work from own company. Lives in Chiang Mai, Thailand.

Twitter

Chiang Mai

Hua Hin

Thailand Hotels

ListVote - List. Vote. Learn.

Partnerseek - Find Partners

Scaffold HABTM

Simple many-to-many relationships in Rails can be defined with the has_and_belongs_to_many directive in the controller. However, this approach has limitations for scaffolding in that Rails does not support rendering the relevant selection controls for the "other side of many" out-of-the box . There are a few plugins that can handle this, namely the scaffolding extension and ActiveScaffold. The latter gives you much richer - albeit somewhat rough around the edges - date entry pages for simply replacing your scaffold :mymodel with active_scaffold :mymodel in your controllers. I did not come across any issues when switching back to the Rails scaffold with the plugin installed but your mileage may vary. There's also a rather lengthy screencast on how to do all this by hand. Hope it helps.