4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/infold/show_associations_controller.rb', line 4
def show
@show_association = ShowAssociation.find(params[:id])
@view = @show_association.app_view
@app = @view.app
association_model = @show_association.model_association.model
association_model.columns.sort_by(&:seq).each do |column|
if @show_association.show_association_fields.find { |r| r.model_column_id == column.id }.blank?
@show_association.show_association_fields.build(
type: ShowAssociationColumn.name,
seq: @show_association.show_association_columns.size,
model_column: column,
display: false)
end
end
association_model.attachment_fields.each do |attachment_field|
if @show_association.show_association_fields.find { |r| r.attachment_field_id == attachment_field.id }.blank?
@show_association.show_association_fields.build(
type: ShowAssociationAttachmentField.name,
seq: @show_association.show_association_columns.size,
attachment_field: attachment_field,
display: false)
end
end
end
|