このプラグインを機能させようとしています。他のスレ読んだけどよくわからん
記事モデルをコメント可能にしようとしています。これは、私がこれまでに行ったことがある場合:
すべてのインストールを正しく行います。
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