elight/acts_as_commentable_with_threading — pull request #49 by climber2002 (2013-07-17 13:59:22+00:00)
Title: add attr_accessible to comment

add attr_accessible to comment, unless my spec will fail as

Failure/Error: @comment = Comment.build_from(child_post, user.id, "This is a comment body")
ActiveModel::MassAssignmentSecurity::Error:
Can't mass-assign protected attributes: commentable, body, user_id
# ./app/models/comment.rb:25:in `new'

my spec is as following

describe "When create a new comment" do
it "should be able to create a comment" do
@comment = Comment.build_from(child_post, user.id, "This is a comment body")
@comment.save
@comment.body.should == "This is a comment body"

child_post.root_comments.size.should == 1
end
end

My rails version 3.2.13