Sha256: b95db9e3628d7b4427111700910b46a06fe8c3855cede0bff17d6e05a953c75b
Contents?: true
Size: 720 Bytes
Versions: 9
Compression:
Stored size: 720 Bytes
Contents
require_relative "associative" module Administrate module Field class BelongsTo < Associative def self.permitted_attribute(attr) :"#{attr}_id" end def permitted_attribute self.class.permitted_attribute(attribute) end def associated_resource_options [nil] + candidate_resources.map do |resource| [display_candidate_resource(resource), resource.id] end end def selected_option data && data.id end private def candidate_resources associated_class.all end def display_candidate_resource(resource) associated_dashboard.display_resource(resource) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems