我试图让这个插件工作。我读过其他线程,但我似乎不明白。
我正在尝试使我的文章模型可评论。如果我到目前为止所做的一切:
正确完成所有安装。
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
在文章#show中:
<%= 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