Yes but somehow I thought that what i'm trying to do here is pretty
simple and that it would not require complex form stuff. Maybe I
should study the complex form stuff more closely. Thanks for the
pointer.

On Feb 18, 5:43 am, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> On 18 Feb 2009, at 13:29, yber...@msn.com wrote:
>
>
>
>
>
> > On the other hand, I could use 'form_for' which generates the same
> > params hash format for both cases (existing and new object) but does
> > not include an id. In this case, I would have the controller pass the
> > view an instance variable: @record_id = 'foo' (in the case of an
> > existing object or @record_id = nil (in the case of a new one. Then
> > i'd pass it back as a hidden field and i'd use a nil value to indicate
> > that it's a new object. This seems similar to your suggestion to use
> > the 'index' option.
>
> > So, basically - i'm asking what the conventional manner for doing this
> > is... In the abstract, the problem is creating a controller and form
> > that can handle either a new object or an existing one while fully
> > leveraging all the goodness that rails provides. After a bunch of
> > reading on this, i've yet to find a 'convention' for this.
>
> Have you looked at the new complex forms stuff ?
>
> Fred
>
> > Thanks always for your generous support!
>
> > Yoram
>
> > On Feb 18, 12:17 am, Frederick Cheung <frederick.che...@gmail.com>
> > wrote:
> >> On Feb 18, 5:38 am, "yber...@msn.com" <yber...@msn.com> wrote:
>
> >>> When my controller passes the view an existing object, I submit the
> >>> form and everything's dandy. When my controller passes the view a  
> >>> new
> >>> object that does not have an id, then I get the error message
> >>> regarding conflicting container types.
>
> >>> Why? Can I use the same form to handle both new and edited objects  
> >>> and
>
> >> Well it's a little tricky to say without seeing the html but that
> >> error message usually means that in the same form you have something
> >> like
> >> foo[]=bar and foo[bar]=baz
>
> >> it may be that passing an :index option to fields for when dealing
> >> with a new record is the way out
>
> >> Fred
>
> >>> at the same time to work as expected with f.text_field? Am I going
> >>> about it the wrong way?  I spent quite a bit of time reading the
> >>> tutorials on the web but still don't understand what's going on  
> >>> here.
>
> >>> Any guidance appreciated!
> >>> Yoram
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to