1
我試圖讓這個插件工作。我讀過其他線程,但我似乎沒有得到它。使用acts_as_commentable_with_threading
我想讓我的文章模型評論。這如果我迄今爲止所做的:
正確完成所有安裝。
class CommentsController < ApplicationController
def create
@article = Article.find(params[:id])
@user_who_commented = @current_user
@comment = Comment.build_from(@article, @user_who_commented.id, "Hey guys this is my comment!")
end
end
在文章#顯示:
<%= form_for @comment do |f| %>
<%= f.text_area :text %>
<%= f.submit "Post Comment" %>
<% end %>
路線:
devise_for :users
resources :dashboard
resources :users, :only => [:index,:show,:edit,:update]
resources :events
resources :januscript do
resources :quotes
end
resources :jmail, :only => [:index, :show]
resources :album
resources :video, :only => [:index, :show]
resources :photos
scope '/archive' do
resources :quotes, :only => [:index]
resources :articles, :only => [:index,:show]
end
resources :comments
我收到此錯誤信息:
undefined method `model_name' for NilClass:Class
我在文章 – masb
中添加了acts_as_commentable編輯我原來的答案。 – Brett