Ruby on Rails Wednesday, February 11, 2015

Yes, I found that too while googling,I think it is helpful
Thx

On Wednesday, February 11, 2015 at 8:58:17 AM UTC+1, gribanov...@gmail.com wrote:
Hi! I think this will help you http://railscasts.com/episodes/240-search-sort-paginate-with-ajax

вторник, 10 февраля 2015 г., 13:05:51 UTC+3 пользователь Melb01 написал:
I already posed my code, I have a paginated list with will_paginate obtained with a search query
the first page is shown correctly but the second is not shown with the js code because the query is not submitted for the second page with ajax code
the params[:q] is nil when I navigate to the second page
def index
    if !params[:q].nil?  
     
      @posts = Post.find_with_q.paginate(:per_page => 10, :page =>  params[:page])
     
      respond_to do |format|
        format.html # index.html.erb
        format.json { render json: @posts }
        format.js
      end
   end

end



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/30503d93-a1c2-4dbe-bf11-798d17ef3b2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment