will-paginate

Rails3 - will_paginate plugin strange output

I have the will_paginate plugin working in an application, but when I paginate a resource it just spits out the HTML as text, doesn't provide links to the next pages and such. And when I manually type in the URL the plugin is working it just doesn't make <%= will_paginate @products %> into links such as next 1 2 3 ... last This is the ...

Customizing Number of Page Links Rendered With will_paginate?

I'm using the will_paginate gem for my Rails project and it's working beautifully. Unfortunately, on paginated result sets with a larger number of pages, the link section is too wide. Instead of: « Previous 1 2 … 5 6 7 8 9 10 11 12 13 … 18 19 Next » I would like to show: « Previous 1 2 … 5 6 7 8 9 … 18 19 Next » How can I reduce ...

will_paginate route only works on page > 1

I have the following routes defined: map.resources :categories, :has_many => :downloads map.resources :downloads, :member => {:go => :get}, :collection => {:tag => :get} map.connect '/downlods/page/:page', :controller => 'downloads', :action => 'index' map.connect '/categories/:category_id/downloads/page/:page', :controller => 'download...

Showing pagination with only single page using will_paginate

I'm using will_paginate as standard, but it only shows the pagination controls (< 1 2 > etc) when there's more than one page to display. Normally, this would be what is wanted, but I want to see the pagination controls (for UI consistency and to get round an annoying CSS quirk in the system I'm working on) even when there's only 1 page t...

will_paginate with named_scopes

I'm using will_paginate for pagination, which has been working well so far, except for this one thing. If I try to paginate a scope, for instance class User < ActiveRecord::Base named_scope :scope, lambda { etc } end User.scope.paginate({:page => params[:page], :per_page => 10}) That will tell me paginate is an undefined metho...

Undefined method 'total_entries' after upgrading Rails 2.2.2 to 2.3.5

I am upgrading a Rails application from 2.2.2 to 2.3.5. The only remaining error is when I invoke total_entries for creating a jqgrid. Error: NoMethodError (undefined method `total_entries' for #<Array:0xbbe9ab0>) Code snippet: @route = Route.find( :all, :conditions => "id in (#{params[:id]})" ) { if params[:page].present? the...

Rails: Using will_paginate with a complex association find

I'm encountering a problem with will_paginate while doing a complex find. :photo has_many :tags, :through => :tagships :item has_many :photos :photo belongs_to :item @photos = @item.photos.paginate :page => params[:page], :per_page => 200, :conditions => [ 'tags...

Doing will_paginate pages calculation around a record

I'm displaying a list of events. I wanted displayed the page with the events for today by default. That was easy accomplished by: page = number_of_records_before_RECORD / number_of_pages + 1 Now I want to display the first item of today's events as the first item in that page. Maybe there is a way to generate page numbers around a re...

Will_paginate and geokit misbehavior (double query)

Hi all, I'm using will_paginate to paginate my geokit search results. The code works, however, when looking at the log it does double the geokit query when using the following will_paginate call: @posts = Post.paginate :page => params[:page], :per_page => 1, :origin => @search, :within => @miles, :include => :u...

How to make will_paginate work with liquid

I managed to make a little hack to make will_paginate work with liquid: http://gist.github.com/426737 I wonder if this is safe? Ideas? ...

Rails paginate array items one-by-one instead of page-by-page

Hi Guys, I have a group of assets, let's call them "practitioners". I'm displaying these practitioners in the header of a calendar interface. There are 7 columns to the calendar. 7 columns = 7 practitioners per view/page. Right now: if the first page shows you practitioners 1-7, when you go the next page you will see practitioners 8-1...

Will_Paginate - How to add a separator between the inner_window and outer_window values?

I have implemented the following custom link renderer class: class PaginationListLinkRenderer < WillPaginate::LinkRenderer def to_html links = @options[:page_links] ? windowed_links : [] links.unshift(page_link_or_span(@collection.previous_page, 'previous', @options[:previous_label])) links.push(page_link_or_span(@collec...

Multiple conditions with will_paginate

I am using will_paginate for pagination but I can't seem to use more than one condition at a time. For example, if I want to have a sql query that ends in "Where office_id = 5", then it's pretty straight forward, I can do that. but what if I want to do "Where office_id = 5 AND primary_first = 'Mark'"? I can't do that. I have no idea...

Is it possible to filter by conditions before paginating?

I'm using ruby on rails 2.3.8 and will_paginate plugin. I've just noticed that if I write something like this: Announcement.paginate :page => params[:page], :per_page => 10, :conditions => some_condition it will work. But, if I write something like this: announcements = Announcement.all :conditions => some_condition @ann = announce...

Will_paginate Plugin on two objects on same page

Hello I am using will_paginte plugin on two objects on a same page. Like on stackoverflow. There is a profile page on which there is a pagination on two things QUestions and answers. I am having problem ie:-- when user is clicking on questions pagination page 2. answers page are also updating. The reason is both is sending a post vari...

will_paginate produces escaped html in rails3, raw and .html_safe do not seem to help.

will_paginate produces escaped html, what am I missing here. I've verified that will_paginate producted html_save code, I've tried adding will_paginate(@pictures).html_safe as well. Note that page_entries_info works as it should, its just the main helper that is messed up. For the time being I've done the code manually, but for obviou...

Will Paginate Rails 3 Per Page

I am trying to limit the number of elements returned with mislav's will paginate with Rails 3. I am currently using: # Gemfile gem 'will_paginate', :git => 'git://github.com/mislav/will_paginate.git', :branch => 'rails3' # company.rb class Company < ActiveRecord::Base self.per_page = 8 end # company_controller.rb def index @compan...

Rails rendering ul li list with will_paginate

Hello, I'm using will_paginate in my rails application, it's working fine but I would like to use ul li list for my webdesigner layout. Actually with my code, it's only rendering my view : <div class="pagination"> <ul><li><%= will_paginate @organizations %></li></ul> </div> My source code: <ul><li><div class="pagination"> <span...

rails searchlogic and will_paginate undefined method `order' for #<WillPaginate::Collection:0x37530ac>

Does anyone have the same problem or a working solution? I get always this error message, here are model, controller and view code class Profile < ActiveRecord::Base cattr_reader :per_page @@per_page = 10 end def index @search = Profile.search(params[:search]) @profiles = @search.paginate(:page => params[:page]) end <%=...

How can I localize will_paginate in ruby on rails?

Good morning :), I like to localize the "previous" and "next" links in will_paginate, how can I do that? Did anyone find a nice workaround? Thanks in advance cheers tabaluga ...