Jang Choe
2006-Apr-12 19:53 UTC
[Rails] Sorting with SQL for has_one, belongs_to relationship
I''ve been using this sort helper to have sortable tables. http://wiki.rubyonrails.com/rails/pages/Sort+Helper I''ve encountered a situation where I need to sort a column that is not part of a table, but it''s related table. For example, say I have db tables called foos and bars. Foos have fields called name and title. And bars have fields called note and foo_id. Foos has_one bar. My HTML table needs to have columns name, title, and note and need to sort among them. Is there a way to use sort helper to sort those columns? I''ve looked at pure javascript solutions but I couldn''t find anything that fully supports safari. Thanks.