質問編集履歴

2

タグ追加

2016/12/19 08:51

投稿

stimlocy
stimlocy

スコア11

test CHANGED
File without changes
test CHANGED
File without changes

1

gemfileとmaigration 追記

2016/12/19 08:51

投稿

stimlocy
stimlocy

スコア11

test CHANGED
File without changes
test CHANGED
@@ -55,3 +55,203 @@
55
55
 
56
56
 
57
57
  また、setupでusersを使わず、postの中身をrails consoleで通った内容にしても、user.emailがユニークでないとエラーを吐かれます。
58
+
59
+
60
+
61
+
62
+
63
+ ###追記
64
+
65
+ ```
66
+
67
+ source 'https://rubygems.org'
68
+
69
+
70
+
71
+
72
+
73
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
74
+
75
+ gem 'rails', '4.2.6'
76
+
77
+ # Use sqlite3 as the database for Active Record
78
+
79
+ gem 'sqlite3'
80
+
81
+ # Use SCSS for stylesheets
82
+
83
+ gem 'sass-rails', '~> 5.0'
84
+
85
+ # Use Uglifier as compressor for JavaScript assets
86
+
87
+ gem 'uglifier', '>= 1.3.0'
88
+
89
+ # Use CoffeeScript for .coffee assets and views
90
+
91
+ gem 'coffee-rails', '~> 4.1.0'
92
+
93
+ # See https://github.com/rails/execjs#readme for more supported runtimes
94
+
95
+ # gem 'therubyracer', platforms: :ruby
96
+
97
+
98
+
99
+ # Use jquery as the JavaScript library
100
+
101
+ gem 'jquery-rails'
102
+
103
+ # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
104
+
105
+ gem 'turbolinks'
106
+
107
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
108
+
109
+ gem 'jbuilder', '~> 2.0'
110
+
111
+ # bundle exec rake doc:rails generates the API under doc/api.
112
+
113
+ gem 'sdoc', '~> 0.4.0', group: :doc
114
+
115
+
116
+
117
+ # Use ActiveModel has_secure_password
118
+
119
+ # gem 'bcrypt', '~> 3.1.7'
120
+
121
+
122
+
123
+ # Use Unicorn as the app server
124
+
125
+ # gem 'unicorn'
126
+
127
+
128
+
129
+ # Use Capistrano for deployment
130
+
131
+ # gem 'capistrano-rails', group: :development
132
+
133
+
134
+
135
+ group :development, :test do
136
+
137
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
138
+
139
+ gem 'byebug'
140
+
141
+ end
142
+
143
+
144
+
145
+ group :development do
146
+
147
+ # Access an IRB console on exception pages or by using <%= console %> in views
148
+
149
+ gem 'web-console', '~> 2.0'
150
+
151
+
152
+
153
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
154
+
155
+ gem 'spring'
156
+
157
+ end
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+ gem 'devise'
166
+
167
+ ```
168
+
169
+
170
+
171
+ ```
172
+
173
+ class DeviseCreateUsers < ActiveRecord::Migration
174
+
175
+ def change
176
+
177
+ create_table :users do |t|
178
+
179
+ ## Database authenticatable
180
+
181
+ t.string :email, null: false, default: ""
182
+
183
+ t.string :encrypted_password, null: false, default: ""
184
+
185
+
186
+
187
+ ## Recoverable
188
+
189
+ t.string :reset_password_token
190
+
191
+ t.datetime :reset_password_sent_at
192
+
193
+
194
+
195
+ ## Rememberable
196
+
197
+ t.datetime :remember_created_at
198
+
199
+
200
+
201
+ ## Trackable
202
+
203
+ t.integer :sign_in_count, default: 0, null: false
204
+
205
+ t.datetime :current_sign_in_at
206
+
207
+ t.datetime :last_sign_in_at
208
+
209
+ t.string :current_sign_in_ip
210
+
211
+ t.string :last_sign_in_ip
212
+
213
+
214
+
215
+ ## Confirmable
216
+
217
+ # t.string :confirmation_token
218
+
219
+ # t.datetime :confirmed_at
220
+
221
+ # t.datetime :confirmation_sent_at
222
+
223
+ # t.string :unconfirmed_email # Only if using reconfirmable
224
+
225
+
226
+
227
+ ## Lockable
228
+
229
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
230
+
231
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
232
+
233
+ # t.datetime :locked_at
234
+
235
+
236
+
237
+
238
+
239
+ t.timestamps null: false
240
+
241
+ end
242
+
243
+
244
+
245
+ add_index :users, :email, unique: true
246
+
247
+ add_index :users, :reset_password_token, unique: true
248
+
249
+ # add_index :users, :confirmation_token, unique: true
250
+
251
+ # add_index :users, :unlock_token, unique: true
252
+
253
+ end
254
+
255
+ end
256
+
257
+ ```