При отправке новой формы я получаю «Нет совпадений по маршруту [POST]».Никаких совпадений маршрута [POST] при отправке новой формы в Rails
### /routes.rb ###
resources :artists, controller: 'artists/artists', only: [:show] do
member do
resources :videos, controller: 'artists/videos', only: [:index, :new, :create, :edit, :update]
end
end
### /artists/videos/videos_controller.rb ###
class Artists::VideosController < ApplicationController
before_action :set_artist
def new
@video = ArtistVideo.new
end
def create
@video = @artist.create_artist_video(video_params)
if @video.save
redirect_to current_artist
else
render 'new'
end
end
private
def set_artist
@artist = current_artist
end
end
### /artists/videos/new.html.erb ###
<%= form_for(@video, url: new_video_path) do |f| %>
<%= f.label :video_title, "title", class: "label" %>
<%= f.text_field :video_title, class: "text-field" %>
<%= f.label :video_description, "decription", class: "label" %>
<%= f.text_field :video_description, class: "text-field" %>
<%= f.label :youtube_video_url, "youtube url", class: "label" %>
<%= f.text_field :youtube_video_url, class: "text-field" %>
<%= f.submit "add video", class: "submit-button" %>
<% end %>
### rake routes ###
videos_path GET /artists/:id/videos(.:format) artists/videos#index
POST /artists/:id/videos(.:format) artists/videos#create
new_video_path GET /artists/:id/videos/new(.:format) artists/videos#new
edit_video_path GET /artists/:id/videos/:id/edit(.:format) artists/videos#edit
video_path PATCH /artists/:id/videos/:id(.:format) artists/videos#update
PUT /artists/:id/videos/:id(.:format) artists/videos#update
Так что не уверен, что я делаю неправильно здесь. Я пробовал: полностью индексировать, так что video_path использует метод post, но у меня все еще такая же проблема.
Я использую метод has_many, связывающий видео с художниками, если это даже имеет значение.
Не уверен, что это неправильные маршруты или код контроллера. Любая помощь будет оценена по достоинству.