field :collection_attrs, Hash, default: Hash.new, doc: “Extra attributes to pass to the collection on creation – eg. key_method”
# File lib/gorillib/model/field.rb, line 136 def initialize(model, name, type, options={}) super collection_type = self.type item_type = self.item_type key_method = options[:key_method] if options[:key_method] raise "Please supply an item type for #{self.inspect} -- eg 'collection #{name.inspect}, of: FooClass'" unless item_type self.default ||= ->{ collection_type.new(item_type: item_type, belongs_to: self, key_method: key_method) } end
Generated with the Darkfish Rdoc Generator 2.