Reputation: 110950
I have the following, which gives me a list of comments:
@comments = record.commentable.comments
record in this case is a comment captured by an observer. What I want to do is get a list of comments excluding the recent comment, which in this case is record.
I tried the following but it errors with
"ActionView::Template::Error (wrong number of arguments (0 for 1)):"
@comments = record.commentable.comments.where(:id != record.id)
Suggestions? thanks
Upvotes: 3
Views: 1961
Reputation: 12574
@comments = record.commentable.comments.where('id <> ?' , record.id)
More info here:
Upvotes: 7