Sunday, June 24, 2012

Re: [Rails] How do I sort my columns inside my AJAX search result?


 def index
   @user = current_user
   @search = @user.products.search do
     fulltext params[:search]
   end
   @products = @search.results
 end


if @search is not an ActiveRecord::Relation object you cant chain it with  another ActiveRecord::Relation object. What class does the search function returns? are you using a gem? the search function could be returning an array in which case you have to build your own sorting mechanism.

--
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