在社区的#show 页面上,我得到:
未定义的方法“评论”
我想知道为什么我会收到这个错误?
community_topics_controller.rb
def show
@community_topic = CommunityTopic.find params[:id]
@comment = @community_topic.comments.build
@community_topic.comments.pop
respond_to do |format|
format.html # show.html.erb
format.json { render json: @community_topic }
end
end
模型/community_topic.rb
acts_as_commentable
意见/community_topics/show.html.erb
<%= render 'comments/form' %>
意见/评论/_form.html.erb
<div class="field">
<%= f.label :comment %><br />
<%= f.text_area :comment %>
<%= f.hidden_field :commentable_id %>
<%= f.hidden_field :commentable_type %>
</div>