Sha256: 94c37faee391f9c237dff4b69ec57bca8b67884b3a5e28cc4918347367608b74
Contents?: true
Size: 408 Bytes
Versions: 6
Compression:
Stored size: 408 Bytes
Contents
module Madmin module Fields class HasMany < Field def options_for_select(record) association = record.class.reflect_on_association(attribute_name) klass = association.klass klass.all.map do |r| ["#{klass.name} ##{r.id}", r.id] end end def to_param {"#{attribute_name.to_s.singularize}_ids".to_sym => []} end end end end
Version data entries
6 entries across 6 versions & 1 rubygems