mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 08:16:26 +00:00
23 lines
424 B
Ruby
23 lines
424 B
Ruby
# 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
|