質問編集履歴

5

routes.rbを追加

2018/11/01 12:49

投稿

ayachika
ayachika

スコア36

test CHANGED
File without changes
test CHANGED
@@ -617,3 +617,67 @@
617
617
  新規登録後、戻されるページのURLは以下のとおりです。登録前と変わらないところに戻されます!
618
618
 
619
619
  https://b1fcca702fd243a2b259db29bd0cfdd6.vfs.cloud9.ap-southeast-1.amazonaws.com/signup
620
+
621
+
622
+
623
+ ・routes.rbを追加します!
624
+
625
+
626
+
627
+ ```
628
+
629
+ Rails.application.routes.draw do
630
+
631
+ get 'sessions/new'
632
+
633
+
634
+
635
+ get 'static_pages/home'
636
+
637
+
638
+
639
+ get '/about', to: 'static_pages#about'
640
+
641
+ get '/contact', to: 'static_pages#contact'
642
+
643
+ get '/signup', to: 'users#new'
644
+
645
+ post '/signup', to: 'users#create'
646
+
647
+ resources :users
648
+
649
+ get '/login', to: 'sessions#new'
650
+
651
+
652
+
653
+ post '/login', to: 'sessions#create'
654
+
655
+ delete '/logout', to: 'sessions#destroy'
656
+
657
+ get 'comments/create'
658
+
659
+
660
+
661
+ get 'comments/destroy'
662
+
663
+
664
+
665
+ # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
666
+
667
+ root 'static_pages#home'
668
+
669
+
670
+
671
+ resources :favorites, only: %i[create destroy]
672
+
673
+ resources :comments, only: %i[create destroy]
674
+
675
+
676
+
677
+ resources :posts
678
+
679
+ end
680
+
681
+
682
+
683
+ ```

4

質問事項に対して回答を追加

2018/11/01 12:49

投稿

ayachika
ayachika

スコア36

test CHANGED
File without changes
test CHANGED
@@ -553,3 +553,67 @@
553
553
  gem 'font-awesome-rails'
554
554
 
555
555
  ```
556
+
557
+
558
+
559
+
560
+
561
+ ・users/new.html.erbを追加しました!!
562
+
563
+ ```
564
+
565
+ <% provide(:title, 'Sign up') %>
566
+
567
+ <h1>無料会員登録</h1>
568
+
569
+
570
+
571
+ <div class="row">
572
+
573
+ <div class="col-md-6 col-md-offset-3">
574
+
575
+ <%= form_for(@user, url: signup_path) do |f| %>
576
+
577
+ <%= render 'shared/error_messages' %>
578
+
579
+
580
+
581
+ <%= f.label :name %>
582
+
583
+ <%= f.text_field :name, class: 'form-control' %>
584
+
585
+
586
+
587
+ <%= f.label :email %>
588
+
589
+ <%= f.email_field :email, class: 'form-control' %>
590
+
591
+
592
+
593
+ <%= f.label :password %>
594
+
595
+ <%= f.password_field :password, class: 'form-control' %>
596
+
597
+
598
+
599
+ <%= f.label :password_confirmation, "Confirmation" %>
600
+
601
+ <%= f.password_field :password_confirmation, class: 'form-control' %>
602
+
603
+
604
+
605
+ <%= f.submit "アカウントを作成する", class: "btn btn-primary" %>
606
+
607
+ <% end %>
608
+
609
+ </div>
610
+
611
+ </div>
612
+
613
+ ```
614
+
615
+
616
+
617
+ 新規登録後、戻されるページのURLは以下のとおりです。登録前と変わらないところに戻されます!
618
+
619
+ https://b1fcca702fd243a2b259db29bd0cfdd6.vfs.cloud9.ap-southeast-1.amazonaws.com/signup

3

Gemfileの中身について記載

2018/11/01 09:18

投稿

ayachika
ayachika

スコア36

test CHANGED
File without changes
test CHANGED
@@ -423,3 +423,133 @@
423
423
 
424
424
 
425
425
  ```
426
+
427
+
428
+
429
+ ・Gemfileを追加。bcryptがあることを確認しました。
430
+
431
+ ```
432
+
433
+ source 'https://rubygems.org'
434
+
435
+
436
+
437
+
438
+
439
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
440
+
441
+ gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
442
+
443
+ # Use sqlite3 as the database for Active Record
444
+
445
+ gem 'sqlite3'
446
+
447
+ # Use Puma as the app server
448
+
449
+ gem 'puma', '~> 3.0'
450
+
451
+ # Use SCSS for stylesheets
452
+
453
+ gem 'sass-rails', '~> 5.0'
454
+
455
+ # Use Uglifier as compressor for JavaScript assets
456
+
457
+ gem 'uglifier', '>= 1.3.0'
458
+
459
+ # Use CoffeeScript for .coffee assets and views
460
+
461
+ gem 'coffee-rails', '~> 4.2'
462
+
463
+ # See https://github.com/rails/execjs#readme for more supported runtimes
464
+
465
+ # gem 'therubyracer', platforms: :ruby
466
+
467
+
468
+
469
+ # Use jquery as the JavaScript library
470
+
471
+ gem 'jquery-rails'
472
+
473
+ # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
474
+
475
+ gem 'turbolinks', '~> 5'
476
+
477
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
478
+
479
+ gem 'jbuilder', '~> 2.5'
480
+
481
+ # Use Redis adapter to run Action Cable in production
482
+
483
+ # gem 'redis', '~> 3.0'
484
+
485
+ # Use ActiveModel has_secure_password
486
+
487
+ # gem 'bcrypt', '~> 3.1.7'
488
+
489
+
490
+
491
+ # Use Capistrano for deployment
492
+
493
+ # gem 'capistrano-rails', group: :development
494
+
495
+
496
+
497
+ group :development, :test do
498
+
499
+ gem 'rspec-rails', '3.1.0'
500
+
501
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
502
+
503
+ gem 'byebug', platform: :mri
504
+
505
+ # 追加
506
+
507
+ gem 'rails-flog', require: 'flog'
508
+
509
+ end
510
+
511
+
512
+
513
+ group :development do
514
+
515
+ # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
516
+
517
+ gem 'web-console'
518
+
519
+ gem 'listen', '~> 3.0.5'
520
+
521
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
522
+
523
+ gem 'spring'
524
+
525
+ gem 'spring-watcher-listen', '~> 2.0.0'
526
+
527
+ end
528
+
529
+
530
+
531
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
532
+
533
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
534
+
535
+
536
+
537
+ gem 'bootstrap-sass', '3.3.7'
538
+
539
+ gem 'data-confirm-modal'
540
+
541
+ gem 'kaminari'
542
+
543
+ gem 'rails-i18n'
544
+
545
+ gem 'annotate'
546
+
547
+ gem 'rake', '< 11.0'
548
+
549
+ gem 'carrierwave'
550
+
551
+ gem 'bcrypt', '3.1.12'
552
+
553
+ gem 'font-awesome-rails'
554
+
555
+ ```

2

db/schema.rbの中身を追加

2018/10/31 09:11

投稿

ayachika
ayachika

スコア36

test CHANGED
File without changes
test CHANGED
@@ -267,3 +267,159 @@
267
267
  以上です。掲載していないコードなどがありましたらご指摘ください。
268
268
 
269
269
  よろしくお願いします。
270
+
271
+
272
+
273
+
274
+
275
+ ・追記
276
+
277
+ db/schema.rbの中身はこのようになっています!
278
+
279
+
280
+
281
+ ```
282
+
283
+ # This file is auto-generated from the current state of the database. Instead
284
+
285
+ # of editing this file, please use the migrations feature of Active Record to
286
+
287
+ # incrementally modify your database, and then regenerate this schema definition.
288
+
289
+ #
290
+
291
+ # Note that this schema.rb definition is the authoritative source for your
292
+
293
+ # database schema. If you need to create the application database on another
294
+
295
+ # system, you should be using db:schema:load, not running all the migrations
296
+
297
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
298
+
299
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
300
+
301
+ #
302
+
303
+ # It's strongly recommended that you check this file into your version control system.
304
+
305
+
306
+
307
+ ActiveRecord::Schema.define(version: 20181016133724) do
308
+
309
+
310
+
311
+ create_table "comments", force: :cascade do |t|
312
+
313
+ t.integer "post_id"
314
+
315
+ t.string "name", null: false
316
+
317
+ t.text "comment", null: false
318
+
319
+ t.datetime "created_at", null: false
320
+
321
+ t.datetime "updated_at", null: false
322
+
323
+ t.index ["post_id"], name: "index_comments_on_post_id"
324
+
325
+ end
326
+
327
+
328
+
329
+ create_table "favorites", force: :cascade do |t|
330
+
331
+ t.integer "user_id", null: false
332
+
333
+ t.integer "post_id", null: false
334
+
335
+ t.datetime "created_at", null: false
336
+
337
+ t.datetime "updated_at", null: false
338
+
339
+ t.index ["post_id"], name: "index_favorites_on_post_id"
340
+
341
+ t.index ["user_id"], name: "index_favorites_on_user_id"
342
+
343
+ end
344
+
345
+
346
+
347
+ create_table "post_tag_relations", force: :cascade do |t|
348
+
349
+ t.integer "post_id"
350
+
351
+ t.integer "tag_id"
352
+
353
+ t.datetime "created_at", null: false
354
+
355
+ t.datetime "updated_at", null: false
356
+
357
+ t.index ["post_id"], name: "index_post_tag_relations_on_post_id"
358
+
359
+ t.index ["tag_id"], name: "index_post_tag_relations_on_tag_id"
360
+
361
+ end
362
+
363
+
364
+
365
+ create_table "posts", force: :cascade do |t|
366
+
367
+ t.string "name"
368
+
369
+ t.string "title"
370
+
371
+ t.text "content"
372
+
373
+ t.integer "user_id"
374
+
375
+ t.datetime "created_at", null: false
376
+
377
+ t.datetime "updated_at", null: false
378
+
379
+ t.string "picture"
380
+
381
+ t.index ["user_id", "created_at"], name: "index_posts_on_user_id_and_created_at"
382
+
383
+ t.index ["user_id"], name: "index_posts_on_user_id"
384
+
385
+ end
386
+
387
+
388
+
389
+ create_table "tags", force: :cascade do |t|
390
+
391
+ t.string "name", null: false
392
+
393
+ t.datetime "created_at", null: false
394
+
395
+ t.datetime "updated_at", null: false
396
+
397
+ end
398
+
399
+
400
+
401
+ create_table "users", force: :cascade do |t|
402
+
403
+ t.string "name"
404
+
405
+ t.string "email"
406
+
407
+ t.datetime "created_at", null: false
408
+
409
+ t.datetime "updated_at", null: false
410
+
411
+ t.string "password_digest"
412
+
413
+ t.string "remember_digest"
414
+
415
+ t.index ["email"], name: "index_users_on_email", unique: true
416
+
417
+ end
418
+
419
+
420
+
421
+ end
422
+
423
+
424
+
425
+ ```

1

タイトルをわかりやすく変更

2018/10/30 22:48

投稿

ayachika
ayachika

スコア36

test CHANGED
@@ -1 +1 @@
1
- railsのアプリにおいて新規登録パスワード入力後空になって登録ページに戻ってしまう
1
+ 新規ユーザー登録しようとするとパスワード入力後空になって登録ページに戻ってしまう問題について
test CHANGED
File without changes