Sha256: 1e294e8a6b082d6f606938887fa2bce96f682fd3d780a4361635daa3fb987766

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

# == Schema Information
#
# Table name: question_categories
#
#  id                 :integer          not null, primary key
#  title_translations :hstore           default({})
#  sort_order         :integer
#  created_at         :datetime         not null
#  updated_at         :datetime         not null
#

class QuestionCategory < ActiveRecord::Base
  validates :title, presence: true

  has_many :questions, dependent: :destroy, foreign_key: :category_id
  translates :title

  scope :sorted, -> { order("#{quoted_table_name}.sort_order") }
  default_scope -> { sorted }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/models/question_category.rb