私はnew.html.erbページでフォームを作成しようとしていますが、未定義のメソッド `task_presentations_path 'エラーが発生しています。フォームを使用したポリモーフィックな関連付け
= form_tag [@task, Presentation.new] do |f|
= f.label :summary
= f.text_field :summary
tasks_controller
def new
@task = Task.new
end
経路
resources :presentations do
resources :tasks
end
タスクモデル
class Task < ApplicationRecord
belongs_to :taskable, polymorphic: true
has_one :task_type
has_one :task_status
end
プレゼンテーションモデル
class Presentation < ApplicationRecord
has_many :tasks, as: :taskable
end
すくいタスク
presentation_tasks GET /presentations/:presentation_id/tasks(.:format) tasks#index
POST /presentations/:presentation_id/tasks(.:format) tasks#create
new_presentation_task GET /presentations/:presentation_id/tasks/new(.:format) tasks#new
edit_presentation_task GET /presentations/:presentation_id/tasks/:id/edit(.:format) tasks#edit
presentation_task GET /presentations/:presentation_id/tasks/:id(.:format) tasks#show
PATCH /presentations/:presentation_id/tasks/:id(.:format) tasks#update
PUT /presentations/:presentation_id/tasks/:id(.:format) tasks#update
DELETE /presentations/:presentation_id/tasks/:id(.:format) tasks#destroy
私は 'bundle exec rake routes | grep task'を実行して、そのルートが呼び出された場所を確認します。それはpresentation_tasks_pathかもしれないようですが、私は確信していません – mccalljt
コントローラとモデルの詳細情報を追加できますか? – Milind
はい更新しました。 – brandoncodes