New action in index view

I want my new view and action (which displays the form in a modal dialog) to be contained in the index view. How can i do this? I am getting an error right now, and I am assuming this because I have <%= form_for(@video) do |f| %> <%= form_for(@video) do |f| %> when @video is defined only in the new view, not in the index view. I'm not sure how to fix this though ...

+4
source share
1 answer

Add @video = Video.new to your video @video = Video.new :

 def index @video = Video.new end 
+4
source

Source: https://habr.com/ru/post/1345034/


All Articles