Matteo
Matteo

Reputation: 63

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

I am migrating from Ruby 2.7.2 to ruby 3.2.2 and now, when I call the "update" method, I receive the following error: ArgumentError (wrong number of arguments (given 3, expected 2))

Here is the code:

def update
   @course = Course.find params[:id]
   @course.update(course_params)
end

private 

def course_params
   params.require(:course).permit(:name, :start_date, :duration)
end

What could be the problem? Thanks

Ruby: 3.2.2 Rails: 6.0

Stack trace: enter image description here

Upvotes: 2

Views: 2613

Answers (1)

Arty.Simon
Arty.Simon

Reputation: 870

Found this article that lists Ruby and Rails Compatibility (updated March 13, 2023).

Perhaps the upgrade path of Rails 6 to 6.1 might be the best course.

https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-0-to-rails-6-1

Upvotes: 2

Related Questions