* James Bond <[email protected]> [2009-01-25 15:07:51 +0100]:
>
> #order can be "date" or "score" or "user"
>
> @order = "date" #default
> @order = session[:order] if session[:order]
> @order = params[:order] if params[:order]
>
> orderby = "updated_on DESC" #default
> orderby = "score DESC" if @order == "score"
> orderby = "user" if @order == "user"
>
> session[:order] = @order
>
> @results = Stats.find(:all, :order => orderby, :conditions..........
@order = params[:order] || session[:order] || 'date'
orderby = case @order
when 'user' then 'user'
when 'score' then 'score DESC'
else 'updated_on DESC'
end
my $0.02
Jan
> --
> 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 [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
> -~----------~----~----~----~------~----~------~--~---
--
jan=callcc{|jan|jan};jan.call(jan)
pgpCSqsygxy5E.pgp
Description: PGP signature

