Are you using 1.4.0.pre7? If so, that should actually work as is.
If you can't switch to 1.4.0.pre7, you can do something like:
if parse_sort_param('user', 'user.email_address')
db_sort_field = {
"user" => "users.last_name",
"user.email_address" => "users.email_address",
}[@sort_field]
order_by=[db_sort_field, @sort_direction]
else
order_by=["users.last_name", "asc"]
@sort_field = "user"
@sort_direction = "asc"
end
then use :order_by => order_by
Bryan
On Mon, Jul 23, 2012 at 11:18 AM, tomkins wrote:
> I have a table plus with fields that I can order, using: :order_by =>
> parse_sort_param(:name, num)
> How can I do this for something like :company.contact so it would be
> :order_by => parse_sort_param(:name, num, company.contact)
> This gives an error when I navigate to the page the table is on.
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/hobousers/-/3cHHSq7XHjYJ.
> To post to this group, send email to hobo...@googlegroups.com.
> To unsubscribe from this group, send email to
> hobousers+unsubscribe@googlegroups.com.
Matt- I'm trying :'contact.company' again and when I click on the header of the column I want to order I don't get an error anymore but I also don't get the arrow and it doesn't order.
2012-07-26T11:36:48+00:00 app[web.1]: /home/heroku_rack/lib/static_assets.rb:9:in `call'
2012-07-26T11:36:48+00:00 app[web.1]: /home/heroku_rack/lib/last_access.rb:15:in `call'
2012-07-26T11:36:48+00:00 app[web.1]: /home/heroku_rack/lib/date_header.rb:14:in `call'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:76:in `pre_process'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:74:in `catch'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:74:in `pre_process'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:57:in `process'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) lib/thin/connection.rb:42:in `receive_data'
2012-07-26T11:36:48+00:00 app[web.1]: eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
2012-07-26T11:36:48+00:00 app[web.1]: eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) lib/thin/backends/base.rb:57:in `start'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) lib/thin/server.rb:156:in `start'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) lib/thin/controllers/controller.rb:80:in `start'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) lib/thin/runner.rb:177:in `send'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) lib/thin/runner.rb:177:in `run_command'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) lib/thin/runner.rb:143:in `run!'
2012-07-26T11:36:48+00:00 app[web.1]: thin (1.2.6) bin/thin:6
2012-07-26T11:36:48+00:00 app[web.1]: /usr/ruby1.8.7/bin/thin:19:in `load'
2012-07-26T11:36:48+00:00 app[web.1]: /usr/ruby1.8.7/bin/thin:19
2012-07-26T11:36:48+00:00 app[web.1]:
2012-07-26T11:36:48+00:00 app[web.1]:
2012-07-26T11:36:48+00:00 app[web.1]: Rendering /app/public/500.html (500 Internal Server Error)