BathHacked/energy-sparks

View on GitHub
app/models/key_stage.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# == 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