Order_by From another Model Field

trying to order_by From another Model Field
if params[:order_by] == ‘name’
@object = Object.paginate(:all, :page =>
self.page_number, :per_page => 50, :order => “#{params[:order_by]}”)
elsif params[:order_by] == ‘last_updated_another_model_object’
@object
= ???
end
Thanks in Advance.

Field name last_update
Model name any_one

On Thu, Apr 15, 2010 at 12:58 PM, Colin L. [email protected]
wrote:

What do want to order by in this case?
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Thanks:
Rajeev sharma

On 15 April 2010 08:20, ashu [email protected] wrote:

trying to order_by From another Model Field
if params[:order_by] == ‘name’
@object = Object.paginate(:all, :page =>
self.page_number, :per_page => 50, :order => “#{params[:order_by]}”)
elsif params[:order_by] == ‘last_updated_another_model_object’
@object
= ???

What do want to order by in this case?

Colin

On 15 April 2010 08:30, kannav rajeev [email protected] wrote:

Field name last_update
Model name any_one

It is better to post your reply in the appropriate place in the
previous email, it makes it easier to follow the thread. I understand
when you say you want to order by the field last_update, ( :order =>
:last_update ) but what do you mean by sorting on a model named
any_one?

Colin

http://thedevelopercorner.blogspot.com/2009/03/ruby-on-rails-order-by-using-associated.html

I Got It Thanks For Replying all.

On 4/15/10, Colin L. [email protected]n.invalid wrote:

Colin

self.page_number, :per_page => 50, :order => “#{params[:order_by]}”)
You received this message because you are subscribed to the Google G.

http://groups.google.com/group/rubyonrails-talk?hl=en.


Thanks:
Rajeev sharma

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs