If you dont want to replace them by numbers in the table as suggested by @titibouboul . You can just do.
class Grade
CATEGORY_IN_ORDER = ["Prelim", "Midterm", "Semi-Finals", "Finals"]
scope :ordered_by_category, lambda {"order(FIELD(category,#{CATEGORY_IN_ORDER.join(',')}))"}
end
then anywhere you can use this scope as:
Grade.ordered_by_category.where(YOUR_CRITERIA)
if you dont want to define scopes:
Grade.where(YOUR_CRITERIA).order("FIELD(category,#{CATEGORY_IN_ORDER.join(',')})")
More about order by FIELD syntax here:
http://www.electrictoolbox.com/mysql-order-specific-field-values/