На странице #show сообщества я получаю:
неопределенный метод `comments '
Мне было интересно, почему я получил эту ошибку?
<Сильный> 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 %>
<%= f.text_area :comment %>
<%= f.hidden_field :commentable_id %>
<%= f.hidden_field :commentable_type %>
</div>