Closed pareeohnos closed 10 years ago
it doesn't work using this code
acts_as_commentable :public, :private, { class_name: 'SampleComment' }
error message as follow:
SELECT "comments".id FROM "comments" WHERE "comments"."commentable_id" = ? AND "comments"."commentable_type" = ? AND "comments"."role" = 'public' [["commentable_id", 6], ["commentable_type", "Sample"]] SQLite3::SQLException: no such column: comments.role: SELECT "comments".id FROM "comments" WHERE "comments"."commentable_id" = ? AND "comments"."commentable_type" = ? AND "comments"."role" = 'public'
Currently,
acts_as_commentable
assumes that your model is calledComment
and provides no way of changing this.This pull request allows you to provide options to the
acts_as_commentable
method that will be given to thehas_many
method internally. This way, you can set any of the options thathas_many
accepts as if you were calling it directly. This does not break support for the roles either, and requires no change to existing code so should not cause any issues in version upgrades.Whilst I didn't create this directly to solve the issue, this does in fact solve the closed issue #25.
This PR also complements PR #51, as the
gemspec
file was still referencing theUSEGA
file and not the renamedUSAGE
file, causing it to give a warning about an invalid gemspec.