class Basepack::Forms::Fields::HasManyAssociation
Public Instance Methods
build_resource()
click to toggle source
# File lib/basepack/forms/fields/has_many_association.rb, line 21 def build_resource # TODO - raise exception for `through' assoc: form.resource_class.reflect_on_association(name).nested? value.build end
bulk_editable?()
click to toggle source
returns true only for for N-N associations
# File lib/basepack/forms/fields/has_many_association.rb, line 35 def bulk_editable? #N-N association are only with: # has_many through: <join_table>, where join_table has foreign_keys for both associations reflection = abstract_model.model.reflect_on_association(name) ( (ActiveRecord::Reflection::ThroughReflection === reflection) and (reflection.through_reflection.macro == :has_many) and (reflection.source_reflection.macro == :belongs_to) ) end
parse_input(params)
click to toggle source
# File lib/basepack/forms/fields/has_many_association.rb, line 26 def parse_input(params) if params[method_name].is_a? String params[method_name] = params[method_name].split ',' else @delegate.parse_input(params) if @delegate end end