nevermind. classic rtfm. in this case, http://wiki.merbivore.com/my_first_blog is rosetta.
On Jan 20, 11:41 pm, sonicpond <[email protected]> wrote: > i have two models that relate to each other as many-to-many. > > class User > property :id, Serial > property :name, String > has n, :studygroups, :through => Resource > end > > class Studygroup > property :id, Serial > property :name, String > has n, :users, :through => Resource > end > > when i build a form for studygroup, it behaves as expected until i > submit it at which it complains that > > undefined method `collection=' for ["id", "1"]:Array > > i'm using a dropdown to choose a new user. that user should then be > appended to the studygroup.users collection when the post hits the > studygroup controller (i think). > > the problem is in this piece of haml. > > %td > approve new user > %select{:name => 'studygroup[users][id]'} > - @user.each do |user| > %option{:value => user.id} > = user.name > > which renders this piece of html: > > <td> > approve new user > <select name='studygroup[users][id]'> > <option value='1'> > guy smiley > </option> > </select> > </td> > > i'm populating the form with data from @studygroup but i'm also making > the @user collection available so new users can be chosen. > > maybe i'm abusing or mishandling update_attributes (i'm using the > update action without any modifications). my intuition is that it's > trying to work, but i'm not naming the form element correctly in first > place. > > i would be grateful for help in understanding the basic strategies and > syntaxes to use for generic many-to-many gigs. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/merb?hl=en -~----------~----~----~----~------~----~------~--~---
