# How to sort columns from more than one table using Ajax?

**URL:** <https://discuss.rubyonrails.org/t/how-to-sort-columns-from-more-than-one-table-using-ajax/11883>\
**Category:** rubyonrails-talk\
**Created:** [April 19, 2007, 3:34pm UTC](https://discuss.rubyonrails.org/t/how-to-sort-columns-from-more-than-one-table-using-ajax/11883 "2007-04-19T15:34:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duplex](https://avatars.discourse-cdn.com/v4/letter/d/96bed5/32.png) [@Duplex](https://discuss.rubyonrails.org/u/Duplex)\
**Post date:** [April 19, 2007, 3:34pm UTC](https://discuss.rubyonrails.org/t/how-to-sort-columns-from-more-than-one-table-using-ajax/11883/1 "2007-04-19T15:34:41Z")

</div>

some code would help. can you show e.g. the controller? generally i would say you have to include the table name in the property to sort by, e.g.

@events = Event.find(:all, :include =\> :location, :order =\> "location.name")

so "location.name" (or "location.name\_reverse") would be the param in the sort link to sort by location name.

i'm just guessing here what the problem might be, as i said show some code that might clear things up.
