Sha256: 5b77f421fbce739d1361542103681a11c2a66cdce4430dbfa41328692f3481c5
Contents?: true
Size: 844 Bytes
Versions: 1
Compression:
Stored size: 844 Bytes
Contents
require_relative "base" require "administrate/page/table" module Administrate module Field class HasMany < Field::Base def associated_table Administrate::Page::Table.new(associated_dashboard) end def self.permitted_attribute(attribute) { "#{attribute.to_s.singularize}_ids".to_sym => [] } end def permitted_attribute self.class.permitted_attribute(attribute) end def attribute_key permitted_attribute.keys.first end def candidate_records Object.const_get(resource_class_name).all end private def associated_dashboard Object.const_get("#{resource_class_name}Dashboard").new end def resource_class_name options[:class_name] || attribute.to_s.singularize.camelcase end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
administrate-0.0.10 | lib/administrate/fields/has_many.rb |