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.
you forgot an =
for the form_for
<%= form_for(@demo) do |f| %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With