Question

I am using sinatra 1.4.3 and mongoid 3.1.4. I tried adding will_paginate gem from master branch for mongoid support so I added this to my gemfile:

gem 'will_paginate', :git => 'git://github.com/mislav/will_paginate.git', 
                     :branch => 'master'

In environment.rb I added:

require 'will_paginate'
require 'will_paginate/mongoid'

And pagination method started working. I have still problem with will_paginate helper. In my views I get errors like:

NoMethodError: undefined method `will_paginate' for #<Class:0x006ff5df8578b0>

Am I missing something for helper to work under sinatra?

Was it helpful?

Solution

I don't know if it's best solution but adding

include WillPaginate::Sinatra::Helpers

in my controller solved my problems.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top