Sha256: 13d15cfa1ff163473c0655ee853f4d72386cd10da12ff4c97d3117ba0b2d7044

Contents?: true

Size: 370 Bytes

Versions: 8

Compression:

Stored size: 370 Bytes

Contents

require_relative "base"

module Administrate
  module Field
    class BelongsTo < Field::Base
      def self.permitted_attribute(attr)
        :"#{attr}_id"
      end

      def permitted_attribute
        self.class.permitted_attribute(attribute)
      end

      def candidate_records
        Object.const_get(attribute.to_s.camelcase).all
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
administrate-0.0.10 lib/administrate/fields/belongs_to.rb
administrate-0.0.9 lib/administrate/fields/belongs_to.rb
administrate-0.0.8 lib/administrate/fields/belongs_to.rb
administrate-0.0.7 lib/administrate/fields/belongs_to.rb
administrate-0.0.6 lib/administrate/fields/belongs_to.rb
administrate-0.0.4 lib/administrate/fields/belongs_to.rb
administrate-0.0.3 lib/administrate/fields/belongs_to.rb
administrate-0.0.2 lib/administrate/fields/belongs_to.rb