Method: Binda::FieldGroupsHelper#get_relationable_components

Defined in:
app/helpers/binda/field_groups_helper.rb

#get_relationable_components(field_setting) ⇒ Object

Get all components related to a “relation” field setting



11
12
13
14
15
16
17
# File 'app/helpers/binda/field_groups_helper.rb', line 11

def get_relationable_components(field_setting)
  if @instance.class.to_s == 'Binda::Component'
    Component.where(structure_id: Structure.where(id: field_setting.accepted_structure_ids)).where.not(id: @instance.id)
  elsif @instance.class.to_s == 'Binda::Board' 
    Component.where(structure_id: Structure.where(id: field_setting.accepted_structure_ids))
  end
end