AndyV | 17 May 22:28

Re: help needed with where and how best to set a param


The DRY form recipe extends the FormBuilder so you'll get all the
freebies that the FormBuilder is already providing -- like the ability
to tell if you've got a new object to create or an existing object to
update.  If you follow the logic presented in the recipe you should be
able to extend it to denote required fields, too.  You should be able
to provide a 'required' attribute in a similar way they provide the
override for the label.

HTH,
AndyV

On May 16, 4:11 pm, Becca Girl <rails-mailing-l...@...>
wrote:
> 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 viahttp://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
-~----------~----~----~----~------~----~------~--~---


Gmane