質問編集履歴
2
誤字訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -88,13 +88,13 @@
|
|
88
88
|
|
89
89
|
def create
|
90
90
|
|
91
|
-
@
|
91
|
+
@article = Article.new(article_params)
|
92
92
|
|
93
|
-
if @
|
93
|
+
if @article.save
|
94
94
|
|
95
95
|
flash[:success] = "Successfully created..."
|
96
96
|
|
97
|
-
redirect_to @
|
97
|
+
redirect_to @article
|
98
98
|
|
99
99
|
end
|
100
100
|
|
@@ -104,7 +104,7 @@
|
|
104
104
|
|
105
105
|
private
|
106
106
|
|
107
|
-
def
|
107
|
+
def article_params
|
108
108
|
|
109
109
|
params.require(:article).permit(:category_id, :tag_list, :title, :content)
|
110
110
|
|
1
説明の補足
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
**モデル**
|
14
14
|
|
15
|
-
1つの記事に対して
|
15
|
+
1つの記事に対して、複数あるカテゴリーのうちの1つを付与したいので、以下2つのモデルを用意しています。
|
16
16
|
|
17
17
|
```rb
|
18
18
|
|