Order two models by date

Lets say i’ve got

NewsModel with "pub_date" field and get_rendered_html() method

UpdatesModel with "releas_date" and get_rendered_html() method

I want a page to display both news and updates, sorted by date DESC

displaying totally 10 last events.

I’ve thought of fetching 10 records of each model into 2 arrays,

merge them and then multisort by the date field

(which will be either renamed, or fetched with alias).

This process is pretty much expensive.

Are there any better solutions for doing that?

I think better you show them in two separate gridviews in same page.One for news and other for updates.It`ll be easy to manage your issue.

Thanks for the reply Aruna,

but the mixed output is required by the specification

Can you create a View or a third table with data already ordered and call it.

Or … have a 20 times for where show the items of one or other array in base of date item.

I’m sorry if I sound obtuse but you’re dealing with 10 records… does it really matter that much the ‘expense’?

It will still be fast enough, surely?

I do understand your search for best practice though :)

Does that imply creating a third model, say "LatestEvents" related to this view?

Sounds like a good solution for the particular case which i’m gonna implement, however the instances of this model

would not be a deriviation of the original News/Updates classes.

Didnt get ya. What do you mean?

Yep, that’s the case. I could have made a plain select & render avoiding models at all.