質問編集履歴
2
routes.rb追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -35,6 +35,32 @@
|
|
35
35
|
redirect_back(fallback_location: root_path)
|
36
36
|
|
37
37
|
end
|
38
|
+
|
39
|
+
###
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
### routes.rb
|
44
|
+
|
45
|
+
devise_for :users
|
46
|
+
|
47
|
+
root to: "home#index"
|
48
|
+
|
49
|
+
resources :users
|
50
|
+
|
51
|
+
resources :blogs do
|
52
|
+
|
53
|
+
resources :favarites, only: [:create, :destroy]
|
54
|
+
|
55
|
+
resources :comments, only: [:create,:destroy]
|
56
|
+
|
57
|
+
collection do
|
58
|
+
|
59
|
+
get 'search'
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
38
64
|
|
39
65
|
###
|
40
66
|
|
1
#削除とcontroller index追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -56,6 +56,18 @@
|
|
56
56
|
|
57
57
|
|
58
58
|
|
59
|
+
### blogs_controller
|
60
|
+
|
61
|
+
def index
|
62
|
+
|
63
|
+
@blogs = Blog.order(id: "DESC")
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
###
|
68
|
+
|
69
|
+
|
70
|
+
|
59
71
|
### user model
|
60
72
|
|
61
73
|
class User < ApplicationRecord
|
@@ -67,12 +79,6 @@
|
|
67
79
|
has_many :favarites, dependent: :destroy
|
68
80
|
|
69
81
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
# Include default devise modules. Others available are:
|
74
|
-
|
75
|
-
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
76
82
|
|
77
83
|
devise :database_authenticatable, :registerable,
|
78
84
|
|
@@ -108,7 +114,7 @@
|
|
108
114
|
|
109
115
|
|
110
116
|
|
111
|
-
### index
|
117
|
+
### blog:index.heml.erb
|
112
118
|
|
113
119
|
<div class = "container">
|
114
120
|
|