class Category < ActiveRecord::Base
  has_and_belongs_to_many :tags, class_name: 'ActsAsTaggableOn::Tag'

  validates :name, presence: true
  translates :name, fallbacks_for_empty_translations: true
  accepts_nested_attributes_for :translations

  def self.sorted_categories
    categories_without_sonstige = order('name').where("name <> 'Sonstiges'")
    category_sonstige           = where(name: 'Sonstiges')

    categories_without_sonstige + category_sonstige
  end

end

class Category < ActiveRecord::Base
  has_and_belongs_to_many :tags, class_name: 'ActsAsTaggableOn::Tag'

  validates :name, presence: true
  translates :name, fallbacks_for_empty_translations: true
  accepts_nested_attributes_for :translations

  def self.sorted_categories
    categories_without_sonstige = where("name <> 'Sonstiges'").sort_by(&:name)
    category_sonstige           = where(name: 'Sonstiges')

    categories_without_sonstige + category_sonstige
  end

end

Use sort_by instead of order when sorting the categories
Use sort_by instead of order when sorting the categories

The command 'order' did not work in the staging database
(maybe because of different database versions)
so we changed that to the ruby command sort_by
