form_for not showing up

routes, ruby-on-rails

Solution

you forgot an `=` for the form_for

<%= form_for(@demo) do |f| %>

Problem

I have a model called "ExpDemo" and want to use it from "MainController." I setup the code like this: main_controller.rb ``` def pre @demo = ExpDemo.new end ``` main/pre.html.erb ``` <% form_for(@demo) do |f| %> ... <% end %> ``` Until here, I experienced 'path' error. ``` undefined method `exp_demos_path' ``` So, I added following to routes.rb and the error message gone. ``` resources :exp_demos ``` Now, the form is not showing up in the HTML page. I think the routing setup is the problem, but I'm not sure how to fix it. Please help me to resolve this issue.

Original source