i''m working with a has_many :through association. a person has many people through connections. connection is the join model. the first step for the UI was to only allow the creation of one connection at a time. I would show a primary person and a list of possible connections with radio buttons. the user would choose only one and hit submit. that''s clearly restful: a POST to the create method in the ConnectionsController. now, however, i''d like to allow users to create more than one connection at a time. the app will present a checkbox list of possible connections and the user can create many connections with one submit. Now the RESTful vision gets muddy for me. I started writing a bulk_create method in my ConnectionsController, but the controller started to feel less pure. What should I do? 1. add a bulk_create method and have it loop through the array of people do many POSTs to the original create method? or 2. add a bulk_create method and have it work directly to the Connection model? or 3. add a new array parameter to the orig create method so that a POST would create many new connections at once. or is there another option? none of these feel like ideal. i''m guessing this is a pattern that folks have encountered. but I didn''t have much luck searching around. -b --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
or maybe I do a post to the index? -b On May 31, 3:39 am, brian mulloy <br...-Hle2P7BEKdH1P9xLtpHBDw@public.gmane.org> wrote:> i''m working with a has_many :through association. a person has many > people through connections. > > connection is the join model. the first step for the UI was to only > allow the creation of one connection at a time. I would show a > primary person and a list of possible connections with radio buttons. > the user would choose only one and hit submit. that''s clearly > restful: a POST to the create method in the ConnectionsController. > > now, however, i''d like to allow users to create more than one > connection at a time. the app will present a checkbox list of > possible connections and the user can create many connections with one > submit. > > Now the RESTful vision gets muddy for me. > > I started writing a bulk_create method in my ConnectionsController, > but the controller started to feel less pure. > > What should I do? > > 1. add a bulk_create method and have it loop through the array of > people do many POSTs to the original create method? > or > 2. add a bulk_create method and have it work directly to the > Connection model? > or > 3. add a new array parameter to the orig create method so that a POST > would create many new connections at once. > > or is there another option? none of these feel like ideal. i''m > guessing this is a pattern that folks have encountered. but I didn''t > have much luck searching around. > > -b--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
err. duh. scratch that. On May 31, 3:46 am, brian mulloy <br...-Hle2P7BEKdH1P9xLtpHBDw@public.gmane.org> wrote:> or maybe I do a post to the index? > > -b > > On May 31, 3:39 am, brian mulloy <br...-Hle2P7BEKdH1P9xLtpHBDw@public.gmane.org> wrote: > > > i''m working with a has_many :through association. a person has many > > people through connections. > > > connection is the join model. the first step for the UI was to only > > allow the creation of one connection at a time. I would show a > > primary person and a list of possible connections with radio buttons. > > the user would choose only one and hit submit. that''s clearly > > restful: a POST to the create method in the ConnectionsController. > > > now, however, i''d like to allow users to create more than one > > connection at a time. the app will present a checkbox list of > > possible connections and the user can create many connections with one > > submit. > > > Now the RESTful vision gets muddy for me. > > > I started writing a bulk_create method in my ConnectionsController, > > but the controller started to feel less pure. > > > What should I do? > > > 1. add a bulk_create method and have it loop through the array of > > people do many POSTs to the original create method? > > or > > 2. add a bulk_create method and have it work directly to the > > Connection model? > > or > > 3. add a new array parameter to the orig create method so that a POST > > would create many new connections at once. > > > or is there another option? none of these feel like ideal. i''m > > guessing this is a pattern that folks have encountered. but I didn''t > > have much luck searching around. > > > -b--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---