Search code examples
ruby-on-railsruby-on-rails-3paginationtag-cloud

rails pagination with tag cloud


im using kaminari. It's working with a chain and i have ActiveRecord::Relation object, but i cant figure out, howto avoid this error.

Code here, have trouble with stackoverflow redactor :/ http://pastie.org/1602799

Problem is when i hit tag, i got error

undefined method `current_page' for #<ActiveRecord::Relation:0x9ee7cb8>

I seen some solution, but they for will_paginate and seems deprecated, how can i do pagination for tag_cloud properly? Without pagination everything work perfectly.

I try both kaminari and will_paginate, both give me errors :(


Solution

  • Does this have any effect?

    def tag
      @posts = Post.tagged_with(params[:id]).page(params[:page])
      @tags = Post.tag_counts_on(:tags)
      render :action => 'index'
    end