我有两个类(Impressions 和 Replies),它们继承自父类 Comment:
class CommentsController < ApplicationController
. . . .
end
class ImpressionsController < CommentsController
. . . .
end
class RepliesController < CommentsController
. . . .
end
在我看来,我希望它们以相同的方式呈现。现在,我正在接近它:
<%= render @comment %>
理想情况下,这将呈现部分“/comments/_comment”,但 Rails 想要呈现诸如“/impressions/_impression”或“/replies/_replies”之类的东西。有什么方法可以让 Rails 强大起来做“/comments/_comment”?