{"record":{"id":"9a413fd2a7ce56ec","repo":"mislav/will_paginate","slug":"renderer-not-specified","errorCode":null,"errorMessage":":renderer not specified","messagePattern":":renderer not specified","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/will_paginate/view_helpers.rb","lineNumber":83,"sourceCode":"    #   <%= will_paginate @posts, :style => 'color:blue' %>\n    #\n    # will result in:\n    #\n    #   <div class=\"pagination\" style=\"color:blue\"> ... </div>\n    #\n    def will_paginate(collection, options = {})\n      # early exit if there is nothing to render\n      return nil unless collection.total_pages > 1\n\n      options = WillPaginate::ViewHelpers.pagination_options.merge(options)\n\n      options[:previous_label] ||= will_paginate_translate(:previous_label) { '&#8592; Previous' }\n      options[:next_label]     ||= will_paginate_translate(:next_label) { 'Next &#8594;' }\n\n      # get the renderer instance\n      renderer = case options[:renderer]\n      when nil\n        raise ArgumentError, \":renderer not specified\"\n      when String\n        klass = if options[:renderer].respond_to? :constantize then options[:renderer].constantize\n          else Object.const_get(options[:renderer]) # poor man's constantize\n          end\n        klass.new\n      when Class then options[:renderer].new\n      else options[:renderer]\n      end\n      # render HTML for pagination\n      renderer.prepare collection, options, self\n      output = renderer.to_html\n      output = output.html_safe if output.respond_to?(:html_safe)\n      output\n    end\n\n    # Renders a message containing number of displayed vs. total entries.\n    #\n    #   <%= page_entries_info @posts %>","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/mislav/will_paginate/blob/50017c3eb0712e7b3a53268a81e81a184b7a49f6/lib/will_paginate/view_helpers.rb#L65-L101","documentation":"will_paginate's view helper resolves a renderer object via a case on options[:renderer]; the nil branch raises ArgumentError ':renderer not specified'. A renderer is normally injected for you: the gem's Rails integration seeds WillPaginate::ViewHelpers.pagination_options[:renderer] (e.g. WillPaginate::ActionView::LinkRenderer), so hitting this nil branch means that global default was never set or was cleared.","triggerScenarios":"Calling WillPaginate::ViewHelpers#will_paginate outside the wired environment (plain ERB through a non-Rails stack, Sinatra/hand-rolled views, a Rails console/preview context that never loaded the railtie), or app code that resets/merges over WillPaginate::ViewHelpers.pagination_options and drops :renderer.","commonSituations":"Using the gem in a non-Rails project without requiring a renderer; an initializer that assigns pagination_options = {...} wholesale instead of merging; a gem load-order problem where the railtie never ran; upgrading and a custom bootstrap stopped requiring 'will_paginate/action_view'.","solutions":["Set the global default once at boot: WillPaginate::ViewHelpers.pagination_options[:renderer] ||= WillPaginate::ActionView::LinkRenderer","Or pass it per call: will_paginate(@posts, renderer: WillPaginate::ActionView::LinkRenderer)","Verify the Rails integration is loaded (require 'will_paginate' / the railtie fires) and fix any initializer that overwrites pagination_options instead of merging into it"],"exampleFix":"// before\n# config/initializers/will_paginate.rb had overwritten options and dropped :renderer\nWillPaginate::ViewHelpers.pagination_options = { previous_label: '<<', next_label: '>>' }\n\n// after\nWillPaginate::ViewHelpers.pagination_options.merge!(previous_label: '<<', next_label: '>>')\nWillPaginate::ViewHelpers.pagination_options[:renderer] ||= WillPaginate::ActionView::LinkRenderer","handlingStrategy":"validation","validationCode":"# fail fast at boot instead of mid-request in a view\nraise ':renderer not specified: set WillPaginate::ViewHelpers.pagination_options[:renderer]' unless WillPaginate::ViewHelpers.pagination_options[:renderer]","typeGuard":"def will_paginate_renderer_configured?\n  !WillPaginate::ViewHelpers.pagination_options[:renderer].nil?\nend","tryCatchPattern":"begin\n  = will_paginate @posts\nrescue ArgumentError => e\n  raise unless e.message == ':renderer not specified'\n  # last-resort: pass the renderer explicitly\n  render partial: 'shared/pager', locals: { collection: @posts, renderer: WillPaginate::ActionView::LinkRenderer }\nend","preventionTips":["Set pagination_options[:renderer] in an initializer loaded after the railtie, using merge!/||= rather than wholesale assignment","Add a boot-time assertion that the renderer default is present so misconfiguration surfaces at deploy, not in production views","When using will_paginate outside Rails, require the appropriate renderer (action_view, sinatra) explicitly"],"tags":["will-paginate","renderer","configuration","rails"],"backgroundTag":"missing-renderer-option","analyzedSha":"50017c3eb0712e7b3a53268a81e81a184b7a49f6","analyzedAt":"2026-08-21T19:50:58.546Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}