Sha256: 30b69e6c3db431d539a2a89322ca70904e25d1383f6beed19fba54e2b2017124

Contents?: true

Size: 499 Bytes

Versions: 1

Compression:

Stored size: 499 Bytes

Contents

class CmRole < ApplicationRecord
  include CmAdmin::CmRole

  has_many :cm_permissions

  validates :name, uniqueness: true, presence: true
  validate :valid_default_redirect_path

  has_paper_trail

  private

  def valid_default_redirect_path
    return if default_redirect_path.blank?

    begin
      Rails.application.routes.recognize_path(default_redirect_path)
    rescue ActionController::RoutingError
      errors.add(:default_redirect_path, 'should be valid rails path')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cm-admin-3.0.15 app/models/cm_role.rb