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

質問編集履歴

3

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

2017/12/31 02:02

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -97,4 +97,23 @@
97
97
 
98
98
  <%= render "devise/shared/links" %>
99
99
 
100
+ ```
101
+
102
+ ```
103
+ #heroku log
104
+ Started GET "/users/sign_up" for 111.103.247.179 at 2017-12-30 19:08:50 +0000
105
+ 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
106
+ 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
107
+ 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)
108
+ 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)
109
+ 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)
110
+ 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
111
+ 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
112
+ 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
113
+ 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"=>"登録"}
114
+ 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)
115
+ 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]
116
+ 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>):
117
+ 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]
118
+ 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'
100
119
  ```

2

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

2017/12/31 02:02

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -16,4 +16,85 @@
16
16
  です。
17
17
 
18
18
  初歩的な質問で申し訳ないですが、ご教授いただければと思います。
19
- どうぞよろしくお願い致します。
19
+ どうぞよろしくお願い致します。
20
+
21
+ 【追記】
22
+
23
+ ソースコードを追記いたします。
24
+ アプリの動作としては、短い文章を投稿したり、それらを閲覧したりお気に入りにしたりすることができます。
25
+
26
+ また、問題部分の`encrypted_password`というカラムはdeviseによって作られたものです。
27
+
28
+ ```ruby
29
+ #schema.rb
30
+ ActiveRecord::Schema.define(version: 20171230191810) do
31
+
32
+ create_table "favorites", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
33
+ t.integer "user_id", null: false
34
+ t.integer "messages_id", null: false
35
+ t.datetime "created_at", null: false
36
+ t.datetime "updated_at", null: false
37
+ t.index ["messages_id"], name: "index_favorites_on_messages_id", using: :btree
38
+ t.index ["user_id"], name: "index_favorites_on_user_id", using: :btree
39
+ end
40
+
41
+ create_table "messages", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
42
+ t.integer "user_id"
43
+ t.string "contents"
44
+ t.datetime "created_at", null: false
45
+ t.datetime "updated_at", null: false
46
+ end
47
+
48
+ create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
49
+ t.string "email", default: "", null: false
50
+ t.string "encrypted_password", default: "", null: false
51
+ t.string "reset_password_token"
52
+ t.datetime "reset_password_sent_at"
53
+ t.datetime "remember_created_at"
54
+ t.integer "sign_in_count", default: 0, null: false
55
+ t.datetime "current_sign_in_at"
56
+ t.datetime "last_sign_in_at"
57
+ t.string "current_sign_in_ip"
58
+ t.string "last_sign_in_ip"
59
+ t.datetime "created_at", null: false
60
+ t.datetime "updated_at", null: false
61
+ t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
62
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
63
+ end
64
+
65
+ end
66
+ ```
67
+
68
+ ```html
69
+ registrations/new.html.erb
70
+ <h2>ユーザー登録</h2>
71
+
72
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
73
+ <%= devise_error_messages! %>
74
+
75
+ <div class="field">
76
+ <%= f.label :email %><br />
77
+ <%= f.email_field :email, autofocus: true %>
78
+ </div>
79
+
80
+ <div class="field">
81
+ <%= f.label :password %>
82
+ <% if @minimum_password_length %>
83
+ <em>(<%= @minimum_password_length %> 文字以上)</em>
84
+ <% end %><br />
85
+ <%= f.password_field :password, autocomplete: "off" %>
86
+ </div>
87
+
88
+ <div class="field">
89
+ <%= f.label :password_confirmation %><br />
90
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
91
+ </div>
92
+
93
+ <div class="actions">
94
+ <%= f.submit "登録", class: "btn btn-primary" %>
95
+ </div>
96
+ <% end %>
97
+
98
+ <%= render "devise/shared/links" %>
99
+
100
+ ```

1

発生状況を追記しました

2017/12/31 01:53

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -3,6 +3,8 @@
3
3
  Rails5でdeviseを使ったアプリケーションを作っているのですが、
4
4
  ローカルで問題なく動作するものがHerokuにあげるとエラーになってしまいます。
5
5
 
6
+ 新規登録の場面で送信ボタンを押すと、以下のエラーが出てcreateができません。
7
+
6
8
  ```
7
9
  NoMethodError (undefined method `encrypted_password=' for #<User:0x00000003d79b48>)
8
10
  ```