I've a post model with act-as-taggable-on gem. Both tables have timestamps.
I started with
def tags
@posts = current_user.posts.find_tagged_with(params[:tag], :order => "@posts.tags.updated_at DESC"])
end
And when that didn't work, I tried changing things and ended up with this mess.
def tags
@posts = current_user.posts.find_tagged_with(params[:tag])
@tags = @posts.tags.all
@posts = @tags(params[:tag, :order => "@posts.tags.updated_at DESC"])
end
I basically want to sort by when the tags was last updated.
Bonus: Sort by tag.updated_at or post.updated_at, but in this particular app, I'll be updating tags the most, so just first one will be fine.
Any help is appreciated.