Justin Meltzer
Justin Meltzer

Reputation: 13548

New action in index view

I want to have my new view and action (which displays a form in a modal dialogue) to be contained within the index view. How can I do this? Right now I get an error, and I assume it's because I have <%= form_for(@video) do |f| %> when @video is only defined in the new view and not the index view. I'm not sure how to correct this though...

Upvotes: 4

Views: 930

Answers (1)

Lamp
Lamp

Reputation: 1084

Add @video = Video.new in your video controller:

def index
   @video = Video.new
end

Upvotes: 4

Related Questions