16 May 22:11
Re: help needed with where and how best to set a param
From: Becca Girl <rails-mailing-list@...>
Subject: Re: help needed with where and how best to set a param
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-16 20:11:41 GMT
Subject: Re: help needed with where and how best to set a param
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-16 20:11:41 GMT
AndyV wrote: > Have you tried making this special route a :collection route instead > of a :member route? > > If it were a collection route then the :id would be optional... but it > might also solve the bigger problem more gracefully. In your popup > action you could have something like this: > > @order = params[:id].nil? ? Order.new : Order.find_by_id(params[:id]) > > Then your view could build the url either for insert (new_record?) or > update. If you're already taking advantage of the new Rails 'form_for > @ivar' then it should be done for you. > I will definitely try the route. Right now I'm using the DRY Forms example in the new Advanced Rails Recipes book so I'd like to avoid converting the forms back, but I may need to do that anyway to denote required fields. Thanks. -- -- Posted via http://www.ruby-forum.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 rubyonrails-talk@... To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@... For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
RSS Feed