質問編集履歴

2

試したこと追加

2020/03/12 23:30

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -47,3 +47,91 @@
47
47
 
48
48
 
49
49
  ![イメージ説明](1cfd729d487147463813cb309cb5f3a9.png)
50
+
51
+
52
+
53
+ ・試したこと
54
+
55
+ ```rails
56
+
57
+ $ rails console
58
+
59
+ > user = User.new(name: 'cat', email: 'cat@example.com')
60
+
61
+ > user.save
62
+
63
+ (0.6ms) BEGIN
64
+
65
+ (0.7ms) ROLLBACK
66
+
67
+ NoMethodError: undefined method `content' for #<User:0x0000562feb919878>
68
+
69
+ Did you mean? concern
70
+
71
+ from /usr/local/bundle/gems/activemodel-5.0.7.2/lib/active_model/attribute_methods.rb:433:in `method_missing'
72
+
73
+ from /usr/local/bundle/gems/activemodel-5.0.7.2/lib/active_model/validator.rb:149:in `block in validate'
74
+
75
+ from /usr/local/bundle/gems/activemodel-5.0.7.2/lib/active_model/validator.rb:148:in `each'
76
+
77
+ from /usr/local/bundle/gems/activemodel-5.0.7.2/lib/active_model/validator.rb:148:in `validate'
78
+
79
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:405:in `public_send'
80
+
81
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:405:in `block in make_lambda'
82
+
83
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:169:in `block (2 levels) in halting'
84
+
85
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:547:in `block (2 levels) in default_terminator'
86
+
87
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:546:in `catch'
88
+
89
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:546:in `block in default_terminator'
90
+
91
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:170:in `block in halting'
92
+
93
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:454:in `block in call'
94
+
95
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:454:in `each'
96
+
97
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:454:in `call'
98
+
99
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
100
+
101
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/callbacks.rb:750:in `_run_validate_callbacks'
102
+
103
+ ... 23 levels...
104
+
105
+ from /usr/local/bundle/gems/railties-5.0.7.2/lib/rails/commands/console_helper.rb:9:in `start'
106
+
107
+ from /usr/local/bundle/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:78:in `console'
108
+
109
+ from /usr/local/bundle/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
110
+
111
+ from /usr/local/bundle/gems/railties-5.0.7.2/lib/rails/commands.rb:18:in `<top (required)>'
112
+
113
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `require'
114
+
115
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `block in require'
116
+
117
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:259:in `load_dependency'
118
+
119
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:293:in `require'
120
+
121
+ from /app/bin/rails:9:in `<top (required)>'
122
+
123
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `load'
124
+
125
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `block in load'
126
+
127
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:259:in `load_dependency'
128
+
129
+ from /usr/local/bundle/gems/activesupport-5.0.7.2/lib/active_support/dependencies.rb:287:in `load'
130
+
131
+ from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
132
+
133
+ from /usr/local/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:54:in `require'
134
+
135
+ from -e:1:in `<main>'
136
+
137
+ ```

1

エラーメッセージ追加

2020/03/12 23:30

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,8 +1,12 @@
1
- 下記アプリを作ってる時にユーザー登録ようするとエラーになってしまいました。
1
+ ・前提・実現たいこ
2
2
 
3
- NoMethodError in UsersController#create
3
+ Railsアプリでユーザー登録したい
4
4
 
5
+
6
+
7
+ ・発生している問題・エラーメッセージ
8
+
5
- undefined method `content' for #<User:0x00007f5961024768>
9
+ Railsアプリを作ってる時にユーザー登録しようとするとエラーになってしまいました。
6
10
 
7
11
  UserコントローラーのCreateメソッドにcontentはないのですが。
8
12
 
@@ -12,4 +16,34 @@
12
16
 
13
17
 
14
18
 
19
+ ・ソースコード
20
+
21
+ ```rails
22
+
23
+ def create
24
+
25
+ @user = User.new(name: params[:name], email: params[:email])
26
+
27
+ @user.save
28
+
29
+ redirect_to users_path
30
+
31
+ end
32
+
33
+ ```
34
+
15
35
  [https://github.com/mkakiz/DayShare](https://github.com/mkakiz/DayShare)
36
+
37
+
38
+
39
+ ・問題の発生した環境
40
+
41
+ Rails5
42
+
43
+ Docker
44
+
45
+ Mac
46
+
47
+
48
+
49
+ ![イメージ説明](1cfd729d487147463813cb309cb5f3a9.png)