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. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 15 April 2010 08:20, ashu <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Field name last_update Model name any_one On Thu, Apr 15, 2010 at 12:58 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 15 April 2010 08:20, ashu <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Thanks: Rajeev sharma -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 15 April 2010 08:30, kannav rajeev <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Field name last_update > Model name any_oneIt 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> > > On Thu, Apr 15, 2010 at 12:58 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 15 April 2010 08:20, ashu <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> > > > > -- > Thanks: > Rajeev sharma > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
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 Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 15 April 2010 08:30, kannav rajeev <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 > >> >> >> On Thu, Apr 15, 2010 at 12:58 PM, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> >> wrote: >>> >>> On 15 April 2010 08:20, ashu <rajeevsharma86-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 >>> >>> -- >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> For more options, visit this group at >>> http://groups.google.com/group/rubyonrails-talk?hl=en. >>> >> >> >> >> -- >> Thanks: >> Rajeev sharma >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Thanks: Rajeev sharma -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.