Topic: will_paginate and a strange behaviour...

I'm using this plugin to paginate and it worked fine until now when i have a strange behaviour. In a controller it works perfectly as always, in another (with the same code) if i use a :per_page parameter of for example 2 it displays on the screen 1 result....if i put 3 it displays 2 results......how that is possible?

Re: will_paginate and a strange behaviour...

Can you post your code?

Railscasts - Free Ruby on Rails Screencasts

Re: will_paginate and a strange behaviour...

ryanb wrote:

Can you post your code?

i tried the same code with a find on the other model that with the same code paginates well and it works. So it happened something to this model but i can't figure out what -_-

Re: will_paginate and a strange behaviour...

i also tried to put a single record of that model in the database and i see that will_paginate produces 2 pages even if i have 1 record

Re: will_paginate and a strange behaviour...

It's impossible to say what's wrong without seeing the code. Can you post your model which is causing the problem?

Railscasts - Free Ruby on Rails Screencasts

Re: will_paginate and a strange behaviour...

class Customer < ActiveRecord::Base
 
  acts_as_ferret :fields => [:rag_soc, :company_id, :privato]
  belongs_to :bank
  has_many :contacts, :dependent => :delete_all
  belongs_to :company
  belongs_to :company_type
 
  validates_inclusion_of :tipodoc_deleg, :in => ["Patente", "Carta d'identita'", "Passaporto"], :message => "Tipo documento non inserito"
  validates_inclusion_of :tempo_pag, :in => ["Bimestrale", "Mensile", "Trimestrale"], :message => "Tempo pagamento non inserito"
  validates_uniqueness_of :rag_soc, :message => 'Nome azienda gi

Re: will_paginate and a strange behaviour...

after my brain became crazy i found that deleting the acts_as_ferret index directory and restarting the server now everything works fine smile