5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 03:46:23 +00:00
panel/app/models/concerns/metadata/inverse_concern.rb

24 lines
424 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
module Metadata
module InverseConcern
extend ActiveSupport::Concern
included do
# Hay una relación inversa?
#
# @return [Boolean]
def inverse?
inverse.present?
end
# La relación inversa
#
# @return [Nil,Symbol]
def inverse
@inverse ||= layout.metadata.dig(name, 'inverse')&.to_sym
end
end
end
end