質問編集履歴

3

エラー文の詳細を追記しました。

2017/12/31 02:02

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -197,3 +197,41 @@
197
197
 
198
198
 
199
199
  ```
200
+
201
+
202
+
203
+ ```
204
+
205
+ #heroku log
206
+
207
+ Started GET "/users/sign_up" for 111.103.247.179 at 2017-12-30 19:08:50 +0000
208
+
209
+ 2017-12-30T19:08:50.007807+00:00 app[web.1]: I, [2017-12-30T19:08:50.007724 #4] INFO -- : [28062bb8-c058-433c-bcd9-2f3f04481c51] Processing by Devise::RegistrationsController#new as HTML
210
+
211
+ 2017-12-30T19:08:50.031259+00:00 app[web.1]: I, [2017-12-30T19:08:50.031034 #4] INFO -- : [28062bb8-c058-433c-bcd9-2f3f04481c51] Rendering devise/registrations/new.html.erb within layouts/application
212
+
213
+ 2017-12-30T19:08:50.057356+00:00 app[web.1]: I, [2017-12-30T19:08:50.057109 #4] INFO -- : [28062bb8-c058-433c-bcd9-2f3f04481c51] Rendered devise/shared/_links.html.erb (23.3ms)
214
+
215
+ 2017-12-30T19:08:50.057393+00:00 app[web.1]: I, [2017-12-30T19:08:50.057315 #4] INFO -- : [28062bb8-c058-433c-bcd9-2f3f04481c51] Rendered devise/registrations/new.html.erb within layouts/application (26.1ms)
216
+
217
+ 2017-12-30T19:08:50.067819+00:00 app[web.1]: I, [2017-12-30T19:08:50.067699 #4] INFO -- : [28062bb8-c058-433c-bcd9-2f3f04481c51] Completed 200 OK in 60ms (Views: 58.2ms | ActiveRecord: 0.0ms)
218
+
219
+ 2017-12-30T19:08:50.069436+00:00 heroku[router]: at=info method=GET path="/users/sign_up" host=my_app.herokuapp.com request_id=28062bb8-c058-433c-bcd9-2f3f04481c51 fwd="111.103.247.179" dyno=web.1 connect=0ms service=77ms status=200 bytes=3720 protocol=https
220
+
221
+ 2017-12-30T19:09:01.105846+00:00 app[web.1]: I, [2017-12-30T19:09:01.105737 #4] INFO -- : [c2b8e53c-26e2-418d-ae11-8141a4ada67f] Started POST "/users" for 111.103.247.179 at 2017-12-30 19:09:01 +0000
222
+
223
+ 2017-12-30T19:09:01.108230+00:00 app[web.1]: I, [2017-12-30T19:09:01.108149 #4] INFO -- : [c2b8e53c-26e2-418d-ae11-8141a4ada67f] Processing by Devise::RegistrationsController#create as HTML
224
+
225
+ 2017-12-30T19:09:01.114916+00:00 app[web.1]: I, [2017-12-30T19:09:01.114777 #4] INFO -- : [c2b8e53c-26e2-418d-ae11-8141a4ada67f] Parameters: {"utf8"=>"✓", "authenticity_token"=>"LRgMeu8ux6a2fH1FL4F79MBgYJV7tR6dUmagAh9HzZ+wSFnFzMTkqMF0UYONXQTJmML32/RNuL6/RlSzElIs9g==", "user"=>{"email"=>"kdy78022@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"登録"}
226
+
227
+ 2017-12-30T19:09:01.628005+00:00 app[web.1]: I, [2017-12-30T19:09:01.627769 #4] INFO -- : [c2b8e53c-26e2-418d-ae11-8141a4ada67f] Completed 500 Internal Server Error in 507ms (ActiveRecord: 0.0ms)
228
+
229
+ 2017-12-30T19:09:01.629901+00:00 app[web.1]: F, [2017-12-30T19:09:01.629788 #4] FATAL -- : [c2b8e53c-26e2-418d-ae11-8141a4ada67f]
230
+
231
+ 2017-12-30T19:09:01.636673+00:00 app[web.1]: F, [2017-12-30T19:09:01.636548 #4] FATAL -- : [c2b8e53c-26e2-418d-ae11-8141a4ada67f] NoMethodError (undefined method `encrypted_password=' for #<User:0x00000004656568>):
232
+
233
+ 2017-12-30T19:09:01.636856+00:00 app[web.1]: F, [2017-12-30T19:09:01.636673 #4] FATAL -- : [c2b8e53c-26e2-418d-ae11-8141a4ada67f]
234
+
235
+ 2017-12-30T19:09:01.636929+00:00 app[web.1]: F, [2017-12-30T19:09:01.636859 #4] FATAL -- : [c2b8e53c-26e2-418d-ae11-8141a4ada67f] vendor/bundle/ruby/2.3.0/gems/activemodel-5.0.0.1/lib/active_model/attribute_methods.rb:433:in `method_missing'
236
+
237
+ ```

2

当該部分のソースコードを追記しました。

2017/12/31 02:02

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -35,3 +35,165 @@
35
35
  初歩的な質問で申し訳ないですが、ご教授いただければと思います。
36
36
 
37
37
  どうぞよろしくお願い致します。
38
+
39
+
40
+
41
+ 【追記】
42
+
43
+
44
+
45
+ ソースコードを追記いたします。
46
+
47
+ アプリの動作としては、短い文章を投稿したり、それらを閲覧したりお気に入りにしたりすることができます。
48
+
49
+
50
+
51
+ また、問題部分の`encrypted_password`というカラムはdeviseによって作られたものです。
52
+
53
+
54
+
55
+ ```ruby
56
+
57
+ #schema.rb
58
+
59
+ ActiveRecord::Schema.define(version: 20171230191810) do
60
+
61
+
62
+
63
+ create_table "favorites", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
64
+
65
+ t.integer "user_id", null: false
66
+
67
+ t.integer "messages_id", null: false
68
+
69
+ t.datetime "created_at", null: false
70
+
71
+ t.datetime "updated_at", null: false
72
+
73
+ t.index ["messages_id"], name: "index_favorites_on_messages_id", using: :btree
74
+
75
+ t.index ["user_id"], name: "index_favorites_on_user_id", using: :btree
76
+
77
+ end
78
+
79
+
80
+
81
+ create_table "messages", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
82
+
83
+ t.integer "user_id"
84
+
85
+ t.string "contents"
86
+
87
+ t.datetime "created_at", null: false
88
+
89
+ t.datetime "updated_at", null: false
90
+
91
+ end
92
+
93
+
94
+
95
+ create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
96
+
97
+ t.string "email", default: "", null: false
98
+
99
+ t.string "encrypted_password", default: "", null: false
100
+
101
+ t.string "reset_password_token"
102
+
103
+ t.datetime "reset_password_sent_at"
104
+
105
+ t.datetime "remember_created_at"
106
+
107
+ t.integer "sign_in_count", default: 0, null: false
108
+
109
+ t.datetime "current_sign_in_at"
110
+
111
+ t.datetime "last_sign_in_at"
112
+
113
+ t.string "current_sign_in_ip"
114
+
115
+ t.string "last_sign_in_ip"
116
+
117
+ t.datetime "created_at", null: false
118
+
119
+ t.datetime "updated_at", null: false
120
+
121
+ t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
122
+
123
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
124
+
125
+ end
126
+
127
+
128
+
129
+ end
130
+
131
+ ```
132
+
133
+
134
+
135
+ ```html
136
+
137
+ registrations/new.html.erb
138
+
139
+ <h2>ユーザー登録</h2>
140
+
141
+
142
+
143
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
144
+
145
+ <%= devise_error_messages! %>
146
+
147
+
148
+
149
+ <div class="field">
150
+
151
+ <%= f.label :email %><br />
152
+
153
+ <%= f.email_field :email, autofocus: true %>
154
+
155
+ </div>
156
+
157
+
158
+
159
+ <div class="field">
160
+
161
+ <%= f.label :password %>
162
+
163
+ <% if @minimum_password_length %>
164
+
165
+ <em>(<%= @minimum_password_length %> 文字以上)</em>
166
+
167
+ <% end %><br />
168
+
169
+ <%= f.password_field :password, autocomplete: "off" %>
170
+
171
+ </div>
172
+
173
+
174
+
175
+ <div class="field">
176
+
177
+ <%= f.label :password_confirmation %><br />
178
+
179
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
180
+
181
+ </div>
182
+
183
+
184
+
185
+ <div class="actions">
186
+
187
+ <%= f.submit "登録", class: "btn btn-primary" %>
188
+
189
+ </div>
190
+
191
+ <% end %>
192
+
193
+
194
+
195
+ <%= render "devise/shared/links" %>
196
+
197
+
198
+
199
+ ```

1

発生状況を追記しました

2017/12/31 01:53

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -5,6 +5,10 @@
5
5
  Rails5でdeviseを使ったアプリケーションを作っているのですが、
6
6
 
7
7
  ローカルで問題なく動作するものがHerokuにあげるとエラーになってしまいます。
8
+
9
+
10
+
11
+ 新規登録の場面で送信ボタンを押すと、以下のエラーが出てcreateができません。
8
12
 
9
13
 
10
14