require 'fiona7/attribute_writers/attribute_writer' module Fiona7 module AttributeWriters class ReferenceAsLinklist < AttributeWriter def call(value, claimed_type=nil) # FIXME: use a repository to improve performance obj = self.klass.find(value) rescue nil if obj self.obj.set(self.attr_name, [obj.path]) else self.obj.set(self.attr_name, []) end end end end end