use to_h if available (ruby 2.0/rails4)