On 14 April 2010 12:29, ashu <rajeevsharm...@gmail.com> wrote:

> What i have
>

<snip>


> What i need
>                       when user Click On Age or name or sex records
> should be in that order as user clicked.if user clicked on age Twice
> Then record should reverse . that would be bonus .
> By default it Should Be As working now.
>

OK, so given that this isn't a free-coding forum or a homework-for-you
forum, what do you need?  Hints on how to do this?  Do you have code you've
tried that isn't working?

I'll start you with hints and you can then try it yourself...

1) The :order_by in your link_to will come through in the params hash in
your controller as params[:order_by]

2) You can use :order as an option to ActiveRecord find methods (along with
"ASC" or "DESC" for ordering)

3) You'll need to remember the current order if you want to toggle it on
clicks (or have it as another parameter in your link_to), you can use the
session[:whatever_you_want] = ... construct for that.

People are always happy to help, but you can't just say "I need..."

Cheers,


Andy

-- 
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-t...@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