teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

補足情報の追加

2021/01/03 08:23

投稿

SekiKazuma
SekiKazuma

スコア0

title CHANGED
File without changes
body CHANGED
@@ -5,17 +5,29 @@
5
5
  ### 発生している問題・エラーメッセージ
6
6
 
7
7
  ```
8
- エラーメッセージ
9
8
  ArgumentError in Users#edit
10
9
  wrong number of arguments (given 3, expected 2; required keyword: object)
11
10
  ```
12
11
 
12
+ ```
13
+ ActionView::Template::Error (wrong number of arguments (given 3, expected 2; required keyword: object)):
14
+ 10: <%= f.text_field :profile %>
15
+ 11:
16
+ 12: <%= f.label :profile_image %>
17
+ 13: <%= f.attachment_field :profile_image %>
18
+ 14:
19
+ 15: <%= f.submit %>
20
+ 16:
21
+
22
+ app/views/users/edit.html.erb:13
23
+ app/views/users/edit.html.erb:1
24
+ ```
25
+
13
26
  ### 該当のソースコード
27
+ app/views/users/edit.html.erb
28
+ ```
29
+ <%= form_for @user do |f| %>   #エラー該当文
14
30
 
15
- ```ここに言語名を入力
16
- ソースコード
17
- <%= form_for @user do |f| %>  
18
-
19
31
  <%= f.label :username %>
20
32
  <%= f.text_field :username %>
21
33
 
@@ -32,15 +44,107 @@
32
44
 
33
45
  <% end %>
34
46
  ```
47
+ app/models/user.rb
48
+ ```
49
+ class User < ApplicationRecord
50
+ # Include default devise modules. Others available are:
51
+ # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
52
+ devise :database_authenticatable, :registerable,
53
+ :recoverable, :rememberable, :validatable
35
54
 
55
+ attachment :profile_image
56
+ end
57
+ ```
58
+
59
+ app/controller/users_controller.rb
60
+ ```ここに言語を入力
61
+ class UsersController < ApplicationController
62
+ before_action :set_user, only: [:show, :edit]
63
+
64
+ def index
65
+ @users = User.all
66
+ end
67
+
68
+ def show
69
+ end
70
+
71
+ def edit
72
+ end
73
+ end
74
+
75
+ private
76
+ def set_user
77
+ @user = User.find(params[:id])
78
+ end
79
+
80
+ ```
81
+
82
+ Gemfile
83
+ ```source 'https://rubygems.org'
84
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
85
+
86
+ ruby '3.0.0'
87
+
88
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
89
+ gem 'rails', '~> 6.1.0'
90
+ # Use mysql as the database for Active Record
91
+ gem 'mysql2', '~> 0.5'
92
+ # Use Puma as the app server
93
+ gem 'puma', '~> 5.0'
94
+ # Use SCSS for stylesheets
95
+ gem 'sass-rails', '>= 6'
96
+ # Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
97
+ gem 'webpacker', '~> 5.0'
98
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
99
+ gem 'turbolinks', '~> 5'
100
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
101
+ gem 'jbuilder', '~> 2.7'
102
+ # Use Redis adapter to run Action Cable in production
103
+ # gem 'redis', '~> 4.0'
104
+ # Use Active Model has_secure_password
105
+ # gem 'bcrypt', '~> 3.1.7'
106
+
107
+ # Use Active Storage variant
108
+ # gem 'image_processing', '~> 1.2'
109
+
110
+ # Reduces boot times through caching; required in config/boot.rb
111
+ gem 'bootsnap', '>= 1.4.4', require: false
112
+
113
+ group :development, :test do
114
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
115
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
116
+ end
117
+
118
+ group :development do
119
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
120
+ gem 'web-console', '>= 4.1.0'
121
+ # Display performance information such as SQL time and flame graphs for each request in your browser.
122
+ # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
123
+ gem 'rack-mini-profiler', '~> 2.0'
124
+ gem 'listen', '~> 3.3'
125
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
126
+ gem 'spring'
127
+ end
128
+
129
+ group :test do
130
+ # Adds support for Capybara system testing and selenium driver
131
+ gem 'capybara', '>= 3.26'
132
+ gem 'selenium-webdriver'
133
+ # Easy installation and use of web drivers to run system tests with browsers
134
+ gem 'webdrivers'
135
+ end
136
+
137
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
138
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
139
+
140
+ gem 'devise'
141
+ gem "refile", require: "refile/rails", github: 'manfe/refile'
142
+ gem "refile-mini_magick", github: 'refile/refile-mini_magick'
143
+ gem "bulma-rails"
144
+ ```
36
145
  ### 試したこと
37
146
 
38
147
 
39
148
  controller,model,gemfile等関係するファイルでのスペルミスなどの考え得る人的ミスを確認しましたが、怪しい箇所は特にない状態です。
40
149
 
41
- ### 補足情報(FW/ツールのバージョンなど)
150
+ ### 補足情報(FW/ツールのバージョンなど)
42
- 使用いているGem
43
- ```ここに言語を入力
44
- gem "refile", require: "refile/rails"、github: 'manfe/refile'
45
- gem "refile-mini_magick", github: 'refile/refile-mini_magick'
46
- ```