On Nov 13, 11:13 am, Bob O <[EMAIL PROTECTED]> wrote: > Hello all, > > First let me say im a n00b. Im coming into the OOP world from the > design world. So far so good. With great resources like this, youre > all making my life less painfull.
Welcome! > Question - > > The current project im involved in is in 1.2.3 (not by my choice) That's unfortunate :-) > Basically i have a form partial that i want to be able to route the > information to either create or update, but do this like rails 2 would > do. > > 1 form, 1 submit button, and have it be smart enough to know what to > do. > > this is my form code > > <% form_for :styles, :url => styles_url(:id => current_client.id) do | > f| %> I'm rusty on 1.2.3 syntax, but I think you can just specify the method needed: form_for :styles, :url => styles_url(:id => current_client.id), :method => :put do so actually, you might want to move this into your form partial, passing a local variable to indicate whether or not you should use :method => :put or :method => :post (or you can leave it off entirely for the :post case). I can't tell from your code, but if your partial is using a variable like @styles, then actually you could just look at @styles.new_record? to find out if it's new (i.e. use :post) or old (i.e. use :put). That's actually what the 2.0 code does internally. Hope this helps? Jeff www.purpleworkshops.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

