Sha256: 279a1283605e10556a89cd0e733ecd4a3043634b9a8f8eef0ec73e01a70d7c7b
Contents?: true
Size: 820 Bytes
Versions: 1
Compression:
Stored size: 820 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 attribute.to_s.singularize.camelcase end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
administrate-0.0.6 | lib/administrate/fields/has_many.rb |