Sunday, January 16, 2011

[Rails] Re: Re rendering a page with an additional Param

On Jan 14, 11:36 pm, Cameron Vessey <li...@ruby-forum.com> wrote:
> Chris Habgood wrote in post #974783:
>
> > You can just pass it into the view as a hidden param.
>
> like a session variable or some thing?

I'd avoid session variables.
>
> Well I was thinking that maybe I could build a route that went
> controller/action/id/qty
> So if :qty was absent it would use the general array of tires with that
> :id param and if :qty was present it would then delete all elements that
> didn't meet the qty sent.
>
That is a nicer way of looking at things. It also means (unlike using
a hidden form parameter) that people can link to that precise page,
bookmark it etc.

> Currently the @tires array gets built on were size equals :id. I'm not
> sure how to say if :qty != nil{ delete_if( |t|
> t.qty != :qty}
>
That's pretty much exactly what you'd do (or you might want to add the
condition on qty into what fetches tries from the database)

Fred

> --
> 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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate