質問編集履歴

5

deviseのバージョンを追記

2018/08/28 02:03

投稿

tenten52
tenten52

スコア12

test CHANGED
File without changes
test CHANGED
@@ -269,3 +269,5 @@
269
269
  ruby 2.2.6p396
270
270
 
271
271
  Rails 5.0.7
272
+
273
+ devise 4.5.0

4

試したことに「Deviseを初期状態に戻すと」を追記

2018/08/28 02:03

投稿

tenten52
tenten52

スコア12

test CHANGED
File without changes
test CHANGED
@@ -236,9 +236,11 @@
236
236
 
237
237
 
238
238
 
239
- helo_controller.rbから「 + @account.current_sign_in_at.to_s」を消すと
239
+ helo_controller.rbから「 + @account.current_sign_in_at.to_s」を消し、
240
+
240
-
241
+ Deviseを初期状態に戻すとアプリは正常に動作します。
242
+
241
- アプリ自体は正常に動作します。(ログインできますが、ログイン時刻は表示されません。)
243
+ (ログインできますが、ログイン時刻は表示されません。)
242
244
 
243
245
 
244
246
 

3

誤字の修正

2018/08/28 00:12

投稿

tenten52
tenten52

スコア12

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  「Ruby on Rails 5 超入門」に沿ってアプリを作成し、
6
6
 
7
- ログイン認証後にログイン時刻を表示させようとしています。
7
+ ログイン認証後にログイン時刻を表示させようとしています。
8
8
 
9
9
  Deviseをインストールしましたが、Trackableが組み込まれていなかったので、
10
10
 

2

初心者マークを付けました。

2018/08/27 13:19

投稿

tenten52
tenten52

スコア12

test CHANGED
File without changes
test CHANGED
File without changes

1

ソースコードをMarkdownで見やすくしました。

2018/08/27 13:13

投稿

tenten52
tenten52

スコア12

test CHANGED
File without changes
test CHANGED
@@ -22,19 +22,19 @@
22
22
 
23
23
  undefined method `current_sign_in_at' for #<Account:0x0000000c4ad1f0>
24
24
 
25
- --------------------------------------
25
+ ```ruby
26
26
 
27
27
    else
28
28
 
29
29
  match = matched_attribute_method(method.to_s)
30
30
 
31
- **match ? attribute_missing(match, *args, &block) : super** ←エラー部分
31
+ match ? attribute_missing(match, *args, &block) : super ←エラー部分
32
32
 
33
33
  end
34
34
 
35
35
  end
36
36
 
37
- --------------------------------------
37
+ ```
38
38
 
39
39
 
40
40
 
@@ -44,15 +44,9 @@
44
44
 
45
45
 
46
46
 
47
- いげた(#)の前にシングルクォーテション(')が付いていますが、
48
-
49
- 実際のソースコードにはシングルクォーテション(')は付いていません。
50
-
51
-
52
-
53
47
  helo_controller.rb
54
48
 
55
- --------------------------------------
49
+ ```ruby
56
50
 
57
51
  class HeloController < ApplicationController
58
52
 
@@ -80,15 +74,15 @@
80
74
 
81
75
  end
82
76
 
77
+ ```
78
+
83
- --------------------------------------
79
+ --------------
84
-
85
-
86
80
 
87
81
  20180826062337_devise_create_accounts
88
82
 
89
- --------------------------------------
83
+ ```ruby
90
-
84
+
91
- '# frozen_string_literal: true
85
+ # frozen_string_literal: true
92
86
 
93
87
 
94
88
 
@@ -98,7 +92,7 @@
98
92
 
99
93
  create_table :accounts do |t|
100
94
 
101
- '## Database authenticatable
95
+ ## Database authenticatable
102
96
 
103
97
  t.string :email, null: false, default: ""
104
98
 
@@ -106,7 +100,7 @@
106
100
 
107
101
 
108
102
 
109
- '## Recoverable
103
+ ## Recoverable
110
104
 
111
105
  t.string :reset_password_token
112
106
 
@@ -114,45 +108,45 @@
114
108
 
115
109
 
116
110
 
117
- '## Rememberable
111
+ ## Rememberable
118
112
 
119
113
  t.datetime :remember_created_at
120
114
 
121
115
 
122
116
 
123
- '## Trackable
117
+ ## Trackable
124
-
118
+
125
- '#t.integer :sign_in_count, default: 0, null: false
119
+ #t.integer :sign_in_count, default: 0, null: false
126
-
120
+
127
- __**t.datetime :current_sign_in_at**__
121
+ t.datetime :current_sign_in_at
128
-
122
+
129
- '#t.datetime :last_sign_in_at
123
+ #t.datetime :last_sign_in_at
130
-
124
+
131
- '#t.string :current_sign_in_ip
125
+ #t.string :current_sign_in_ip
132
-
126
+
133
- '#t.string :last_sign_in_ip
127
+ #t.string :last_sign_in_ip
134
-
135
-
136
-
128
+
129
+
130
+
137
- '## Confirmable
131
+ ## Confirmable
138
-
132
+
139
- '# t.string :confirmation_token
133
+ # t.string :confirmation_token
140
-
134
+
141
- '# t.datetime :confirmed_at
135
+ # t.datetime :confirmed_at
142
-
136
+
143
- '# t.datetime :confirmation_sent_at
137
+ # t.datetime :confirmation_sent_at
144
-
138
+
145
- '# t.string :unconfirmed_email # Only if using reconfirmable
139
+ # t.string :unconfirmed_email # Only if using reconfirmable
146
-
147
-
148
-
140
+
141
+
142
+
149
- '## Lockable
143
+ ## Lockable
150
-
144
+
151
- '# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
145
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
152
-
146
+
153
- '# t.string :unlock_token # Only if unlock strategy is :email or :both
147
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
154
-
148
+
155
- '# t.datetime :locked_at
149
+ # t.datetime :locked_at
156
150
 
157
151
 
158
152
 
@@ -168,21 +162,23 @@
168
162
 
169
163
  add_index :accounts, :reset_password_token, unique: true
170
164
 
171
- '# add_index :accounts, :confirmation_token, unique: true
165
+ # add_index :accounts, :confirmation_token, unique: true
172
-
166
+
173
- '# add_index :accounts, :unlock_token, unique: true
167
+ # add_index :accounts, :unlock_token, unique: true
174
168
 
175
169
  end
176
170
 
177
171
  end
178
172
 
173
+ ```
174
+
179
- --------------------------------------
175
+ --------------
180
176
 
181
177
 
182
178
 
183
179
  account.rb
184
180
 
185
- --------------------------------------
181
+ ```ruby
186
182
 
187
183
  class Account < ApplicationRecord
188
184
 
@@ -192,17 +188,17 @@
192
188
 
193
189
  devise :database_authenticatable, :registerable,
194
190
 
195
- :recoverable, :rememberable, __**:trackable**__, :validatable
191
+ :recoverable, :rememberable, :trackable, :validatable
196
192
 
197
193
  end
198
194
 
195
+ ```
196
+
199
- --------------------------------------
197
+ --------------
200
-
201
-
202
198
 
203
199
  schema.rb
204
200
 
205
- --------------------------------------
201
+ ```ruby
206
202
 
207
203
  ActiveRecord::Schema.define(version: 20180826062337) do
208
204
 
@@ -230,7 +226,7 @@
230
226
 
231
227
  end
232
228
 
233
- --------------------------------------
229
+ ```
234
230
 
235
231
 
236
232