app/models/key_stage.rb
# == Schema Information
#
# Table name: key_stages
#
# id :bigint(8) not null, primary key
# name :string
#
# Indexes
#
# index_key_stages_on_name (name) UNIQUE
#
class KeyStage < ApplicationRecord
scope :by_name, -> { order(name: :asc) }
def i18n_key
"#{self.class.model_name.i18n_key}.#{name.parameterize.underscore}"
end
end