Question: I am working on `rails 4` and this are my steps:-

1. `gem kaminari` --in gemfile
2. bundle install
3. `@vendors = Vendor.order(:name).page params[:page]` **in** `vendor_controller.rb)`
also tried `@vendors=Vendor.order("name").page(params[:page]).per(5)`
4. `<% = paginate @vendors %>` in `index.html.erb`

**Error:-**

```
undefined method `page' for #<ActiveRecord::Relation::ActiveRecord_Relation_Vendor:0x16bec10>

```

I have also tried in `console`

```
Vendor.count                 
a = Vendor.limit(5).count     
b = a.page(1).per(20).size

```

**Error:-**
`NOmethoderror undefined method 'page'`

**question:-**
 Where i am going wrong .?

Thanks

Answer: 
Try calling the page method directly from the `ActiveRecord` class. You're calling it after order, which returns an `ActiveRecord::Relation` object.

```
@vendors = Vendor.page(params[:page]).order(:name)

```
I think this one may solve your problem:

```
 vendor.except(:limit, :offset)

```

In model use:

```
 paginates_per 5

```