Sha256: a313568d657ef70984babadf6fcc7d85b638f9622c49c928da1081c42635fa67
Contents?: true
Size: 1.09 KB
Versions: 33
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true require "fmrest/spyke/container_field" module FmRest module Spyke module Model # This module adds support for container fields. # module ContainerFields extend ::ActiveSupport::Concern class_methods do # Defines a container field on the model. # # @param name [Symbol] the name of the container field # # @option options [String] :field_name (nil) the name of the container # field in the FileMaker layout (only needed if it doesn't match # the name given) # # @example # class Honeybee < FmRest::Spyke::Base # container :photo, field_name: "Beehive Photo ID" # end # def container(name, options = {}) field_name = options[:field_name] || name define_method(name) do @container_fields ||= {} @container_fields[name.to_sym] ||= ContainerField.new(self, field_name) end end end end end end end
Version data entries
33 entries across 33 versions & 2 rubygems