mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-24 19:56:21 +00:00
24 lines
424 B
Ruby
24 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
|