categories_physics GET /categories/physics(.:format) categories/physics#index POST /categories/physics(.:format) categories/physics#create new_categories_physic GET /categories/physics/new(.:format) categories/physics#new categories_physic GET /categories/physics/:id(.:format) categories/physics#show DELETE /categories/physics/:id(.:format) categories/physics#destroy categories_math_index GET /categories/math(.:format) categories/math#index POST /categories/math(.:format) categories/math#create new_categories_math GET /categories/math/new(.:format) categories/math#new categories_math GET /categories/math/:id(.:format) categories/math#show DELETE /categories/math/:id(.:format) categories/math#destroy
御覧のとおり学問の名前が20くらいあるルーティングが20くらい続きます。さすがに1つずつモデルをつくるのも違うとおもうのですが、どのようなモデルやコントローラーを実装すればいいですか?
ここら辺に出てくる:idとはなんでしょうかcategoriesのidなのかはたまた学問ごとにmodelがあってそのidなのかそれがわからないと答えれれません
ありがとうございます。 id は学問ごとのモデルがもっているidです。 math のカテゴリーに新しいスレッドをたてると 1, 2, 3... というように増えていく仕様になってます。
えっと、そうですか、そうするとidはスレッドのIDなのでは?categories/physics#indexはphysicsのスレッドの一覧で/categories/physics/:id(.:format)はそこから一つのスレッドを選択すると言うことでは無いのですか?
すみません言い間違えました!id はスレッド名です
回答1件
あなたの回答
tips
プレビュー