質問編集履歴
5
routes.rbを追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -307,4 +307,36 @@
|
|
307
307
|
```
|
308
308
|
|
309
309
|
新規登録後、戻されるページのURLは以下のとおりです。登録前と変わらないところに戻されます!
|
310
|
-
https://b1fcca702fd243a2b259db29bd0cfdd6.vfs.cloud9.ap-southeast-1.amazonaws.com/signup
|
310
|
+
https://b1fcca702fd243a2b259db29bd0cfdd6.vfs.cloud9.ap-southeast-1.amazonaws.com/signup
|
311
|
+
|
312
|
+
・routes.rbを追加します!
|
313
|
+
|
314
|
+
```
|
315
|
+
Rails.application.routes.draw do
|
316
|
+
get 'sessions/new'
|
317
|
+
|
318
|
+
get 'static_pages/home'
|
319
|
+
|
320
|
+
get '/about', to: 'static_pages#about'
|
321
|
+
get '/contact', to: 'static_pages#contact'
|
322
|
+
get '/signup', to: 'users#new'
|
323
|
+
post '/signup', to: 'users#create'
|
324
|
+
resources :users
|
325
|
+
get '/login', to: 'sessions#new'
|
326
|
+
|
327
|
+
post '/login', to: 'sessions#create'
|
328
|
+
delete '/logout', to: 'sessions#destroy'
|
329
|
+
get 'comments/create'
|
330
|
+
|
331
|
+
get 'comments/destroy'
|
332
|
+
|
333
|
+
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
334
|
+
root 'static_pages#home'
|
335
|
+
|
336
|
+
resources :favorites, only: %i[create destroy]
|
337
|
+
resources :comments, only: %i[create destroy]
|
338
|
+
|
339
|
+
resources :posts
|
340
|
+
end
|
341
|
+
|
342
|
+
```
|
4
質問事項に対して回答を追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -275,4 +275,36 @@
|
|
275
275
|
gem 'carrierwave'
|
276
276
|
gem 'bcrypt', '3.1.12'
|
277
277
|
gem 'font-awesome-rails'
|
278
|
-
```
|
278
|
+
```
|
279
|
+
|
280
|
+
|
281
|
+
・users/new.html.erbを追加しました!!
|
282
|
+
```
|
283
|
+
<% provide(:title, 'Sign up') %>
|
284
|
+
<h1>無料会員登録</h1>
|
285
|
+
|
286
|
+
<div class="row">
|
287
|
+
<div class="col-md-6 col-md-offset-3">
|
288
|
+
<%= form_for(@user, url: signup_path) do |f| %>
|
289
|
+
<%= render 'shared/error_messages' %>
|
290
|
+
|
291
|
+
<%= f.label :name %>
|
292
|
+
<%= f.text_field :name, class: 'form-control' %>
|
293
|
+
|
294
|
+
<%= f.label :email %>
|
295
|
+
<%= f.email_field :email, class: 'form-control' %>
|
296
|
+
|
297
|
+
<%= f.label :password %>
|
298
|
+
<%= f.password_field :password, class: 'form-control' %>
|
299
|
+
|
300
|
+
<%= f.label :password_confirmation, "Confirmation" %>
|
301
|
+
<%= f.password_field :password_confirmation, class: 'form-control' %>
|
302
|
+
|
303
|
+
<%= f.submit "アカウントを作成する", class: "btn btn-primary" %>
|
304
|
+
<% end %>
|
305
|
+
</div>
|
306
|
+
</div>
|
307
|
+
```
|
308
|
+
|
309
|
+
新規登録後、戻されるページのURLは以下のとおりです。登録前と変わらないところに戻されます!
|
310
|
+
https://b1fcca702fd243a2b259db29bd0cfdd6.vfs.cloud9.ap-southeast-1.amazonaws.com/signup
|
3
Gemfileの中身について記載
title
CHANGED
File without changes
|
body
CHANGED
@@ -210,4 +210,69 @@
|
|
210
210
|
|
211
211
|
end
|
212
212
|
|
213
|
+
```
|
214
|
+
|
215
|
+
・Gemfileを追加。bcryptがあることを確認しました。
|
216
|
+
```
|
217
|
+
source 'https://rubygems.org'
|
218
|
+
|
219
|
+
|
220
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
221
|
+
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
|
222
|
+
# Use sqlite3 as the database for Active Record
|
223
|
+
gem 'sqlite3'
|
224
|
+
# Use Puma as the app server
|
225
|
+
gem 'puma', '~> 3.0'
|
226
|
+
# Use SCSS for stylesheets
|
227
|
+
gem 'sass-rails', '~> 5.0'
|
228
|
+
# Use Uglifier as compressor for JavaScript assets
|
229
|
+
gem 'uglifier', '>= 1.3.0'
|
230
|
+
# Use CoffeeScript for .coffee assets and views
|
231
|
+
gem 'coffee-rails', '~> 4.2'
|
232
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
233
|
+
# gem 'therubyracer', platforms: :ruby
|
234
|
+
|
235
|
+
# Use jquery as the JavaScript library
|
236
|
+
gem 'jquery-rails'
|
237
|
+
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
238
|
+
gem 'turbolinks', '~> 5'
|
239
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
240
|
+
gem 'jbuilder', '~> 2.5'
|
241
|
+
# Use Redis adapter to run Action Cable in production
|
242
|
+
# gem 'redis', '~> 3.0'
|
243
|
+
# Use ActiveModel has_secure_password
|
244
|
+
# gem 'bcrypt', '~> 3.1.7'
|
245
|
+
|
246
|
+
# Use Capistrano for deployment
|
247
|
+
# gem 'capistrano-rails', group: :development
|
248
|
+
|
249
|
+
group :development, :test do
|
250
|
+
gem 'rspec-rails', '3.1.0'
|
251
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
252
|
+
gem 'byebug', platform: :mri
|
253
|
+
# 追加
|
254
|
+
gem 'rails-flog', require: 'flog'
|
255
|
+
end
|
256
|
+
|
257
|
+
group :development do
|
258
|
+
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
|
259
|
+
gem 'web-console'
|
260
|
+
gem 'listen', '~> 3.0.5'
|
261
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
262
|
+
gem 'spring'
|
263
|
+
gem 'spring-watcher-listen', '~> 2.0.0'
|
264
|
+
end
|
265
|
+
|
266
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
267
|
+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
268
|
+
|
269
|
+
gem 'bootstrap-sass', '3.3.7'
|
270
|
+
gem 'data-confirm-modal'
|
271
|
+
gem 'kaminari'
|
272
|
+
gem 'rails-i18n'
|
273
|
+
gem 'annotate'
|
274
|
+
gem 'rake', '< 11.0'
|
275
|
+
gem 'carrierwave'
|
276
|
+
gem 'bcrypt', '3.1.12'
|
277
|
+
gem 'font-awesome-rails'
|
213
278
|
```
|
2
db/schema.rbの中身を追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -132,4 +132,82 @@
|
|
132
132
|
```
|
133
133
|
|
134
134
|
以上です。掲載していないコードなどがありましたらご指摘ください。
|
135
|
-
よろしくお願いします。
|
135
|
+
よろしくお願いします。
|
136
|
+
|
137
|
+
|
138
|
+
・追記
|
139
|
+
db/schema.rbの中身はこのようになっています!
|
140
|
+
|
141
|
+
```
|
142
|
+
# This file is auto-generated from the current state of the database. Instead
|
143
|
+
# of editing this file, please use the migrations feature of Active Record to
|
144
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
145
|
+
#
|
146
|
+
# Note that this schema.rb definition is the authoritative source for your
|
147
|
+
# database schema. If you need to create the application database on another
|
148
|
+
# system, you should be using db:schema:load, not running all the migrations
|
149
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
150
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
151
|
+
#
|
152
|
+
# It's strongly recommended that you check this file into your version control system.
|
153
|
+
|
154
|
+
ActiveRecord::Schema.define(version: 20181016133724) do
|
155
|
+
|
156
|
+
create_table "comments", force: :cascade do |t|
|
157
|
+
t.integer "post_id"
|
158
|
+
t.string "name", null: false
|
159
|
+
t.text "comment", null: false
|
160
|
+
t.datetime "created_at", null: false
|
161
|
+
t.datetime "updated_at", null: false
|
162
|
+
t.index ["post_id"], name: "index_comments_on_post_id"
|
163
|
+
end
|
164
|
+
|
165
|
+
create_table "favorites", force: :cascade do |t|
|
166
|
+
t.integer "user_id", null: false
|
167
|
+
t.integer "post_id", null: false
|
168
|
+
t.datetime "created_at", null: false
|
169
|
+
t.datetime "updated_at", null: false
|
170
|
+
t.index ["post_id"], name: "index_favorites_on_post_id"
|
171
|
+
t.index ["user_id"], name: "index_favorites_on_user_id"
|
172
|
+
end
|
173
|
+
|
174
|
+
create_table "post_tag_relations", force: :cascade do |t|
|
175
|
+
t.integer "post_id"
|
176
|
+
t.integer "tag_id"
|
177
|
+
t.datetime "created_at", null: false
|
178
|
+
t.datetime "updated_at", null: false
|
179
|
+
t.index ["post_id"], name: "index_post_tag_relations_on_post_id"
|
180
|
+
t.index ["tag_id"], name: "index_post_tag_relations_on_tag_id"
|
181
|
+
end
|
182
|
+
|
183
|
+
create_table "posts", force: :cascade do |t|
|
184
|
+
t.string "name"
|
185
|
+
t.string "title"
|
186
|
+
t.text "content"
|
187
|
+
t.integer "user_id"
|
188
|
+
t.datetime "created_at", null: false
|
189
|
+
t.datetime "updated_at", null: false
|
190
|
+
t.string "picture"
|
191
|
+
t.index ["user_id", "created_at"], name: "index_posts_on_user_id_and_created_at"
|
192
|
+
t.index ["user_id"], name: "index_posts_on_user_id"
|
193
|
+
end
|
194
|
+
|
195
|
+
create_table "tags", force: :cascade do |t|
|
196
|
+
t.string "name", null: false
|
197
|
+
t.datetime "created_at", null: false
|
198
|
+
t.datetime "updated_at", null: false
|
199
|
+
end
|
200
|
+
|
201
|
+
create_table "users", force: :cascade do |t|
|
202
|
+
t.string "name"
|
203
|
+
t.string "email"
|
204
|
+
t.datetime "created_at", null: false
|
205
|
+
t.datetime "updated_at", null: false
|
206
|
+
t.string "password_digest"
|
207
|
+
t.string "remember_digest"
|
208
|
+
t.index ["email"], name: "index_users_on_email", unique: true
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
```
|
1
タイトルをわかりやすく変更
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
新規ユーザー登録しようとするとパスワード入力後空になって登録ページに戻ってしまう問題について
|
body
CHANGED
File without changes
|