i want to selec开发者_如何学Got some rows from different tables and then i want to order them. how can i merge these results and order them according to their created_at values?
@books = Book.all
@notebooks = Notebook.all
@booksandnotebooks = ????
@booksandnotebooks = (@books + @notebooks).sort_by(&:created_at)
Isn't ruby lovely :)
精彩评论