Note that there are some explanatory texts on larger screens.

plurals
  1. PORendering form with route_helper error
    text
    copied!<p>I have these resourse in routes.rb. Comments under topics.</p> <pre><code> namespace :discuss do resources :topics, :as =&gt; :topic do resources :comments, :as =&gt; :comment end end </code></pre> <p>And have _form.html.erb</p> <pre><code>&lt;%= form_for(@topic) do |f| %&gt; &lt;div class="field"&gt; &lt;%= f.label :title %&gt; &lt;%= f.text_field :title %&gt; &lt;/div&gt; &lt;div class="actions"&gt; &lt;%= f.submit %&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre> <p>When rendering this form got error <strong>undefined method `topics_path' for...</strong> around line <strong>&lt;%= form_for(@topic) do |f| %></strong></p> <p>rake routes</p> <pre><code>discuss_topic_comment_index GET /discuss/topics/:topic_id/comments(.:format) discuss/comments#index POST /discuss/topics/:topic_id/comments(.:format) discuss/comments#create new_discuss_topic_comment GET /discuss/topics/:topic_id/comments/new(.:format) discuss/comments#new edit_discuss_topic_comment GET /discuss/topics/:topic_id/comments/:id/edit(.:format) discuss/comments#edit discuss_topic_comment GET /discuss/topics/:topic_id/comments/:id(.:format) discuss/comments#show PUT /discuss/topics/:topic_id/comments/:id(.:format) discuss/comments#update DELETE /discuss/topics/:topic_id/comments/:id(.:format) discuss/comments#destroy discuss_topic_index GET /discuss/topics(.:format) discuss/topics#index POST /discuss/topics(.:format) discuss/topics#create new_discuss_topic GET /discuss/topics/new(.:format) discuss/topics#new edit_discuss_topic GET /discuss/topics/:id/edit(.:format) discuss/topics#edit discuss_topic GET /discuss/topics/:id(.:format) discuss/topics#show PUT /discuss/topics/:id(.:format) discuss/topics#update DELETE /discuss/topics/:id(.:format) discuss/topics#destroy discuss /discuss(.:format) </code></pre> <p>My controller app/controllers/discuss/topics_controller.rb</p> <pre><code>module Discuss class TopicsController &lt; ApplicationController def new @topic = Topic.new respond_to do |format| format.html # new.html.erb format.json { render json: @topic } end end ... some other actions ... end end </code></pre> <p>What I'm doing wrong with this form? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload