Permalink
Browse files

enable access to ViewHelpers.pagination_options for Rails initializers

closes #165
  • Loading branch information...
1 parent dc588e6 commit be12b56289b9a9ede32d8ed2ab5dd51062dcdb2e @mislav committed Aug 23, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/will_paginate/railtie.rb
View
3 lib/will_paginate/railtie.rb
@@ -19,6 +19,9 @@ class Railtie < Rails::Railtie
end
self.class.add_locale_path config
+
+ # early access to ViewHelpers.pagination_options
+ require 'will_paginate/view_helpers'
end
def self.setup_actioncontroller

2 comments on commit be12b56

@t0d0r

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
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.