質問編集履歴
1
補足情報の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,8 +12,6 @@
|
|
12
12
|
|
13
13
|
```
|
14
14
|
|
15
|
-
エラーメッセージ
|
16
|
-
|
17
15
|
ArgumentError in Users#edit
|
18
16
|
|
19
17
|
wrong number of arguments (given 3, expected 2; required keyword: object)
|
@@ -22,15 +20,41 @@
|
|
22
20
|
|
23
21
|
|
24
22
|
|
23
|
+
```
|
24
|
+
|
25
|
+
ActionView::Template::Error (wrong number of arguments (given 3, expected 2; required keyword: object)):
|
26
|
+
|
27
|
+
10: <%= f.text_field :profile %>
|
28
|
+
|
29
|
+
11:
|
30
|
+
|
31
|
+
12: <%= f.label :profile_image %>
|
32
|
+
|
33
|
+
13: <%= f.attachment_field :profile_image %>
|
34
|
+
|
35
|
+
14:
|
36
|
+
|
37
|
+
15: <%= f.submit %>
|
38
|
+
|
39
|
+
16:
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
app/views/users/edit.html.erb:13
|
44
|
+
|
45
|
+
app/views/users/edit.html.erb:1
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
|
50
|
+
|
25
51
|
### 該当のソースコード
|
26
52
|
|
27
|
-
|
53
|
+
app/views/users/edit.html.erb
|
28
|
-
|
54
|
+
|
29
|
-
```
|
55
|
+
```
|
30
|
-
|
31
|
-
|
56
|
+
|
32
|
-
|
33
|
-
<%= form_for @user do |f| %>
|
57
|
+
<%= form_for @user do |f| %> #エラー該当文
|
34
58
|
|
35
59
|
|
36
60
|
|
@@ -66,7 +90,201 @@
|
|
66
90
|
|
67
91
|
```
|
68
92
|
|
69
|
-
|
93
|
+
app/models/user.rb
|
94
|
+
|
95
|
+
```
|
96
|
+
|
97
|
+
class User < ApplicationRecord
|
98
|
+
|
99
|
+
# Include default devise modules. Others available are:
|
100
|
+
|
101
|
+
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
102
|
+
|
103
|
+
devise :database_authenticatable, :registerable,
|
104
|
+
|
105
|
+
:recoverable, :rememberable, :validatable
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
attachment :profile_image
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
```
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
app/controller/users_controller.rb
|
118
|
+
|
119
|
+
```ここに言語を入力
|
120
|
+
|
121
|
+
class UsersController < ApplicationController
|
122
|
+
|
123
|
+
before_action :set_user, only: [:show, :edit]
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
def index
|
128
|
+
|
129
|
+
@users = User.all
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
def show
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
def edit
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
private
|
150
|
+
|
151
|
+
def set_user
|
152
|
+
|
153
|
+
@user = User.find(params[:id])
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
```
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
Gemfile
|
164
|
+
|
165
|
+
```source 'https://rubygems.org'
|
166
|
+
|
167
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
ruby '3.0.0'
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
176
|
+
|
177
|
+
gem 'rails', '~> 6.1.0'
|
178
|
+
|
179
|
+
# Use mysql as the database for Active Record
|
180
|
+
|
181
|
+
gem 'mysql2', '~> 0.5'
|
182
|
+
|
183
|
+
# Use Puma as the app server
|
184
|
+
|
185
|
+
gem 'puma', '~> 5.0'
|
186
|
+
|
187
|
+
# Use SCSS for stylesheets
|
188
|
+
|
189
|
+
gem 'sass-rails', '>= 6'
|
190
|
+
|
191
|
+
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
|
192
|
+
|
193
|
+
gem 'webpacker', '~> 5.0'
|
194
|
+
|
195
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
196
|
+
|
197
|
+
gem 'turbolinks', '~> 5'
|
198
|
+
|
199
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
200
|
+
|
201
|
+
gem 'jbuilder', '~> 2.7'
|
202
|
+
|
203
|
+
# Use Redis adapter to run Action Cable in production
|
204
|
+
|
205
|
+
# gem 'redis', '~> 4.0'
|
206
|
+
|
207
|
+
# Use Active Model has_secure_password
|
208
|
+
|
209
|
+
# gem 'bcrypt', '~> 3.1.7'
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
# Use Active Storage variant
|
214
|
+
|
215
|
+
# gem 'image_processing', '~> 1.2'
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
# Reduces boot times through caching; required in config/boot.rb
|
220
|
+
|
221
|
+
gem 'bootsnap', '>= 1.4.4', require: false
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
group :development, :test do
|
226
|
+
|
227
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
228
|
+
|
229
|
+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
230
|
+
|
231
|
+
end
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
group :development do
|
236
|
+
|
237
|
+
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
238
|
+
|
239
|
+
gem 'web-console', '>= 4.1.0'
|
240
|
+
|
241
|
+
# Display performance information such as SQL time and flame graphs for each request in your browser.
|
242
|
+
|
243
|
+
# Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
|
244
|
+
|
245
|
+
gem 'rack-mini-profiler', '~> 2.0'
|
246
|
+
|
247
|
+
gem 'listen', '~> 3.3'
|
248
|
+
|
249
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
250
|
+
|
251
|
+
gem 'spring'
|
252
|
+
|
253
|
+
end
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
group :test do
|
258
|
+
|
259
|
+
# Adds support for Capybara system testing and selenium driver
|
260
|
+
|
261
|
+
gem 'capybara', '>= 3.26'
|
262
|
+
|
263
|
+
gem 'selenium-webdriver'
|
264
|
+
|
265
|
+
# Easy installation and use of web drivers to run system tests with browsers
|
266
|
+
|
267
|
+
gem 'webdrivers'
|
268
|
+
|
269
|
+
end
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
274
|
+
|
275
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
gem 'devise'
|
280
|
+
|
281
|
+
gem "refile", require: "refile/rails", github: 'manfe/refile'
|
282
|
+
|
283
|
+
gem "refile-mini_magick", github: 'refile/refile-mini_magick'
|
284
|
+
|
285
|
+
gem "bulma-rails"
|
286
|
+
|
287
|
+
```
|
70
288
|
|
71
289
|
### 試したこと
|
72
290
|
|
@@ -79,13 +297,3 @@
|
|
79
297
|
|
80
298
|
|
81
299
|
### 補足情報(FW/ツールのバージョンなど)
|
82
|
-
|
83
|
-
使用いているGem
|
84
|
-
|
85
|
-
```ここに言語を入力
|
86
|
-
|
87
|
-
gem "refile", require: "refile/rails"、github: 'manfe/refile'
|
88
|
-
|
89
|
-
gem "refile-mini_magick", github: 'refile/refile-mini_magick'
|
90
|
-
|
91
|
-
```
|