Closed mabid closed 10 years ago
@mabid there is really a simple fix to this problem. The generator creates a default_scope in the Comment model that orders the comments in ascending order. Remove the default_scope in the comments model and anywhere where you need to ensure the order is in ascending order, you should use the in_order scope like:
model.comments.in_order
@jackdempsey can this issue also be closed as #30 was merged in?
Yep, closing this as well
When calling project.comments.recent the following query is generate
SELECT
comments
.* FROMcomments
WHEREcomments
.commentable_id
= 119 ANDcomments
.commentable_type
= 'Project' ORDER BY created_at ASC, created_at DESCWhy does it add ORDER_BY ASC before adding DESC.
if we call project.comments without any scope it generates following query
SELECT
comments
.* FROMcomments
WHEREcomments
.commentable_id
= 119 ANDcomments
.commentable_type
= 'Project' ORDER BY created_at ASC