mislav/will_paginate

Ruby 3.x - ArgumentError - wrong number of arguments (given 2, expected 1)

bublik opened this issue · 1 comments

I got error on the ruby 3.0.x
the problem in passing params to the translate method

def will_paginate_translate(keys, options = {}) if respond_to? :translate if Array === keys defaults = keys.dup key = defaults.shift else defaults = nil key = keys end translate(key, **options.merge(:default => defaults, :scope => :will_paginate)) else super end end

line
translate(key, options.merge(:default => defaults, :scope => :will_paginate))
should be replaced with the
translate(key, **options.merge(:default => defaults, :scope => :will_paginate))

Hi, there is not enough information here to debug this issue. You've pasted some code, but it's not clear where it's from. A full stack trace would have been helpful to see which method expects 1 argument. Note that the translate method from Rails can receive two arguments: https://api.rubyonrails.org/classes/ActionView/Helpers/TranslationHelper.html#method-i-translate

Feel free to reopen if you add more information to the thread! I'm going to close in the meantime as the issue is most likely elsewhere.