How can rails polymorphism be called in a page?

rails polymorphism problem:

I now have questions , articles , comments three models, one question corresponds to multiple comments , and a article corresponds to multiple comments . Now how to submit comments under question ?

my models is as follows:

Routing Error
uninitialized constant CommentsController

the main problem is this statement:

<%= form_for([@comment.commentable,@comment]) do |f| %>
The essence of

is <% = form_for ([@ question, @ comment]) do | f |% >
url: "/ questions/2/comments" (post request)
that is, you are adding comments to this question, you need a comments controller, and define the create method
, but you do not define

.
Menu