ruby on rails - has and belongs to many view plugin

So I’ll never have to write another has_and_belongs_to_many view again, here’s a plugin that dynamically makes 2 <ul> lists which you drag and drop both ways to manage the association.

http://svn.ahabman.com/public/many_to_many_view/

From the readme:

Assumming you have an @project var and you want to associate people with it.

<div id="m2m_container">
<%= render :partial => "shared/m2m", :locals => {
:thing => @project,
:association => 'people',
:association_attr => 'first_name' }   %>
</div>

:thing take the current object
:association takes the pluralized association, a string.
:association_attr takes the attribute of the associated object that will be displayed.

No Comment

No comments yet

Leave a reply