My two goals:
- display last 10 posts in reverse chronological order
- link to the author without hitting the database 2n-1 times
These work:
def list
@post_pages, @posts = paginate :posts, :order => “created_at DESC”,
:per_page => 10
end
def list
@post_pages, @posts = paginate :posts, :per_page => 10, :include =>
:person
end
This doesn’t:
def list
@post_pages, @posts = paginate :posts, :order => “created_at DESC”,
:per_page => 10, :include => :person
end
I get a “Column ‘created_at’ in order clause is ambiguous” error. I’m
not sure but I thought it was be possible to order the posts and then
join the person table. Otherwise I will hit the database with each
post. Does anyone have a solution to this? Thanks in advance!