I've put return_to hidden fields in forms plenty of times. It doesn't really affect the restfulness imho. Following a guideline like REST exactly at the expense of being explicit is a mistake. Anyway, what you're really saying is you'd like to create the same object from two different contexts. It's just specifying which context you're in so you can render the right page again. (new/edit forms aren't really technically RESTful anyway, so do whatever you want)
Martin Emde On Tue, Jun 15, 2010 at 3:30 PM, Erik Pukinskis <[email protected]>wrote: > Hi y'all, > > I've often got multiple views on my site to the same models, and I get > confused about how to handle it RESTfully. For example, for my User > mode, I have one sign up form for regular users and one for master > gardeners. It seems like both should end up in the users table. > > If both forms post to /users then when the validations fail, they need > to go to different views, depending on which form they came from. But > there's no way to know which form they came from in the controller, > unless I track it with hidden variables, which seems messy. > > I also considered just throwing extra actions in my User controller... > /users/create_master_gardener, /users/24/update_master_gardener, > etc... but that doesn't seem very RESTful, and requires lots of > workarounds with paths and such because it's not very RAILsy either. > > Another alternative is to make a separate model (class MasterGardener > < User) with its own controller and views, but using the same table. > I'm leaning towards that, but I'm wondering if other people have best > practices for this kind of thing. It seems like it would be reasonbly > common. > > Best, > Erik > > -- > SD Ruby mailing list > [email protected] > http://groups.google.com/group/sdruby -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
