Sha256: d7115c5854cde73fe73d8a314b6d16f14ab61899d93c91aa96701f0f4b87c862

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

module Encore
  module Entity
    module Input
      module Associations
        extend ActiveSupport::Concern

        module ClassMethods
          def expose_one(column, opts = {})
            expose_association(:one, column, opts)
          end

          def expose_many(column, opts = {})
            expose_association(:many, column, opts)
          end

        protected

          def expose_association(type, column, opts)
            @exposed_attributes ||= []
            association_class = Encore::Association.const_get("Has#{type.to_s.capitalize}Association")
            @exposed_attributes << association_class.new(self, column.to_sym, opts)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
encore-0.0.3 lib/encore/entity/input/associations.rb