前提・実現したいこと
Ruby3.0.0
rails6.1.0
以上の環境下でusersの編集画面にrefileでの画像アップロードを実装中にエラーを吐かれてしまいましたが、解決方法を探しても見つからないため助言をいただきたいです。
発生している問題・エラーメッセージ
ArgumentError in Users#edit wrong number of arguments (given 3, expected 2; required keyword: object)
ActionView::Template::Error (wrong number of arguments (given 3, expected 2; required keyword: object)): 10: <%= f.text_field :profile %> 11: 12: <%= f.label :profile_image %> 13: <%= f.attachment_field :profile_image %> 14: 15: <%= f.submit %> 16: app/views/users/edit.html.erb:13 app/views/users/edit.html.erb:1
該当のソースコード
app/views/users/edit.html.erb
<%= form_for @user do |f| %> #エラー該当文 <%= f.label :username %> <%= f.text_field :username %> <%= f.label :email %> <%= f.text_field :email %> <%= f.label :profile %> <%= f.text_field :profile %> <%= f.label :profile_image %> <%= f.attachment_field :profile_image %> #エラー該当文 <%= f.submit %> <% end %>
app/models/user.rb
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable attachment :profile_image end
app/controller/users_controller.rb
class UsersController < ApplicationController before_action :set_user, only: [:show, :edit] def index @users = User.all end def show end def edit end end private def set_user @user = User.find(params[:id]) end
Gemfile
source
1git_source(:github) { |repo| "https://github.com/#{repo}.git" } 2 3ruby '3.0.0' 4 5# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 6gem 'rails', '~> 6.1.0' 7# Use mysql as the database for Active Record 8gem 'mysql2', '~> 0.5' 9# Use Puma as the app server 10gem 'puma', '~> 5.0' 11# Use SCSS for stylesheets 12gem 'sass-rails', '>= 6' 13# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker 14gem 'webpacker', '~> 5.0' 15# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 16gem 'turbolinks', '~> 5' 17# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 18gem 'jbuilder', '~> 2.7' 19# Use Redis adapter to run Action Cable in production 20# gem 'redis', '~> 4.0' 21# Use Active Model has_secure_password 22# gem 'bcrypt', '~> 3.1.7' 23 24# Use Active Storage variant 25# gem 'image_processing', '~> 1.2' 26 27# Reduces boot times through caching; required in config/boot.rb 28gem 'bootsnap', '>= 1.4.4', require: false 29 30group :development, :test do 31 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 32 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 33end 34 35group :development do 36 # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 37 gem 'web-console', '>= 4.1.0' 38 # Display performance information such as SQL time and flame graphs for each request in your browser. 39 # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md 40 gem 'rack-mini-profiler', '~> 2.0' 41 gem 'listen', '~> 3.3' 42 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 43 gem 'spring' 44end 45 46group :test do 47 # Adds support for Capybara system testing and selenium driver 48 gem 'capybara', '>= 3.26' 49 gem 'selenium-webdriver' 50 # Easy installation and use of web drivers to run system tests with browsers 51 gem 'webdrivers' 52end 53 54# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 55gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 56 57gem 'devise' 58gem "refile", require: "refile/rails", github: 'manfe/refile' 59gem "refile-mini_magick", github: 'refile/refile-mini_magick' 60gem "bulma-rails"
試したこと
controller,model,gemfile等関係するファイルでのスペルミスなどの考え得る人的ミスを確認しましたが、怪しい箇所は特にない状態です。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。