Sha256: f9151b9ae8deb01144c52c2fb6a38adb194f0d0dfd11fe69e3ad391b83af6d1e
Contents?: true
Size: 538 Bytes
Versions: 32
Compression:
Stored size: 538 Bytes
Contents
# frozen_string_literal: true module Thredded class MessageboardGroup < ActiveRecord::Base has_many :messageboards, inverse_of: :group, foreign_key: :messageboard_group_id, dependent: :nullify scope :ordered, -> { order(position: :asc, id: :asc) } validates :name, presence: true, uniqueness: true validates :position, presence: true, on: :update before_save :ensure_position, on: :create def ensure_position self.position ||= Time.zone.now.to_i end end end
Version data entries
32 entries across 32 versions & 2 rubygems