Hi All,
I would advise you to look at recipe 13 "Handle Multiple Models in
One Form" from Advanced Rails Recipies (by Mike Clark, sold by
pragmatic programmers). It a little too big to post here, so buy the
PDF.
I'm using it and it works great.
Questions like these have been around for much longer and clean
solutions to this have been invented by smart people. Read their
stuff, it helps. Don't try to invent the wheel yourself.
Regards, Bas
On Nov 16, 9:58 am, "Brian Hogan" <[EMAIL PROTECTED]> wrote:
> Yup.
>
> This is *exactly* why you can do
>
> map.resources :apartments, :collection => {:update_all => :put}
>
> Like every convention, there are problems, and there are solutions to that
> problem. Think about ActiveRecord. There are a few edge cases where the
> conventions just break down. But just because you can't do *everything* with
> AciveRecord doesn't mean you throw it out and do everything with DBI and
> execute. :)
>
> On Sat, Nov 15, 2008 at 11:57 AM, Rob Lacey <[EMAIL PROTECTED]>wrote:
>
>
>
> > I think in that situation I'd have an 'update_multiple' controller
> > action, and declare a custom route, it can still be RESTful because
> > you'd use a PUT to update the group of items. It gets fiddly to work
> > with if you have something more complex than the basics. I do agree that
> > REST isn't always the solution and simply isn't the solution in some cases.
>
> > RobL
>
> > Rob Nichols wrote:
> > > Brian,
>
> > > Thank you for your very nice over-view of using REST.
>
> > > However, I think it also demonstrates one of the problems with the
> > > Rails' REST system. It simplifies things when you have a
> > > straight-forward requirement, but complicates them if you need to do
> > > something outside that model.
>
> > > For example, how do you handle a situation where you need to allow a
> > > user to modify multiple instances of an object within a single list
> > > view? Do you really want your user to go through a complete 'list, edit,
> > > update, list' sequence twenty times to change one field on each of
> > > twenty items? Far better I believe to present a
> > > single list of the twenty items and let them submit the changes to all
> > > twenty in one form submission.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---