Skip to content
This repository
Browse code

enable access to ViewHelpers.pagination_options for Rails initializers

closes #165
  • Loading branch information...
commit be12b56289b9a9ede32d8ed2ab5dd51062dcdb2e 1 parent dc588e6
Mislav Marohnić authored

Showing 1 changed file with 3 additions and 0 deletions. Show diff stats Hide diff stats

  1. +3 0  lib/will_paginate/railtie.rb
3  lib/will_paginate/railtie.rb
@@ -19,6 +19,9 @@ class Railtie < Rails::Railtie
19 19 end
20 20
21 21 self.class.add_locale_path config
  22 +
  23 + # early access to ViewHelpers.pagination_options
  24 + require 'will_paginate/view_helpers'
22 25 end
23 26
24 27 def self.setup_actioncontroller

2 comments on commit be12b56

Todor Dragnev

this still don't help when use WillPaginate::ViewHelpers.pagination_options[:previous_label] = 'Previous page' in initializers

I have 2 lines in ./initializers/will_paginate.rb

WillPaginate.per_page = 100
WillPaginate::ViewHelpers.pagination_options[:previous_label] = 'Previous page'

the second one throw exception:

18:47:10 rails.1   |    from /Users/t0d0r/.rvm/gems/ruby-1.9.2-p290/gems/resque-1.19.0/lib/resque/server.rb:12:in `<class:Server>'
18:47:11 rails.1   | Exiting
18:47:11 rails.1   | /Users/t0d0r/work/rails/pilotorder/config/initializers/will_paginate.rb:3:in `<top (required)>': uninitialized constant ViewHelpers (NameError)
18:47:11 rails.1   |    from /Users/t0d0r/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.2/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
18:47:11 rails.1   |    from /Users/t0d0r/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.2/lib/rails/engine.rb:555:in `each'
18:47:11 rails.1   |    from /Users/t0d0r/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.2/lib/rails/engine.rb:555:in `block in <class:Engine>'
18:47:11 rails.1   |    from /Users/t0d0r/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.2/lib/rails/initializable.rb:30:in `instance_exec'

if I don't add

require 'will_paginate/view_helpers'

on top...

bundle show will_paginate
/Users/t0d0r/.rvm/gems/ruby-1.9.2-p290/gems/will_paginate-3.0.2
Mislav Marohnić
Owner

Seems like my fix doesn't fix it? You should open up an issue so I don't forget it. Write what you wrote here, but just paste the error message (whole stack trace isn't necessary)

Please sign in to comment.
Something went wrong with that request. Please try again.