Sha256: 73f229884a215a2c31642082063a2140c765fd65ec4ccd616e90e12db6973844

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

module Alchemy
  module Custom
    module Model
      module PicturesAltMethods

        extend ActiveSupport::Concern

        included do

          def metadata_relation
            # TO BE OVERRIDED WITH HAS_MANY RELATION OF METADATA MODEL SYMBOL
            nil
          end

          def metadata_record(language_code)
            if metadata_relation.nil?
              nil
            else
              self.send(metadata_relation).joins(:language).
                where(alchemy_languages: { language_code: language_code }).first_or_initialize
            end
          end

        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alchemy-custom-model-3.2 lib/alchemy/custom/model/pictures_alt_methods.rb