我一直在嘗試玩Kaminari寶石的分頁,但我遇到了問題。kaminari未定義的方法`頁面'
我有一個簡單的模型一個簡單的啓動項目:
class Position < ActiveRecord::Base
validates_presence_of :name
end
我用Ruby 1.9.2運行和在Ubuntu 10.04軌3.0.5。我已經安裝了kaminari(0.10.4)。
據我瞭解,我應該能夠執行Position.order(「名稱」)第(1),但是當我這樣做,我得到如下:
ruby-1.9.2-p0 > Position.order("name").page(1)
NoMethodError: undefined method `page' for #<ActiveRecord::Relation:0xaacab34>
from /home/bob/.rvm/gems/[email protected]/gems/activerecord-3.0.5/lib/active_record/relation.rb:371:in `method_missing'
from (irb):2
from /home/bob/.rvm/gems/[email protected]/gems/railties-3.0.5/lib/rails/commands/console.rb:44:in `start'
from /home/bob/.rvm/gems/[email protected]/gems/railties-3.0.5/lib/rails/commands/console.rb:8:in `start'
from /home/bob/.rvm/gems/[email protected]/gems/railties-3.0.5/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
這似乎有關就像我能得到的那樣簡單。任何想法將不勝感激。
謝謝。