# frozen_string_literal: true class Core::Builders::<%= @subject_class %> < RiderKick::Builders::AbstractActiveRecordEntityBuilder acts_as_builder_for_entity Core::Entities::<%= @subject_class%> <% if @uploaders.present? -%> def attributes_for_entity { <% @uploaders.each_with_index do |field, index| -%> <% if is_singular?(field) -%> <%= field %>: (Rails.application.routes.url_helpers.polymorphic_url(params.<%= field %>) rescue '')<%= ',' if index < @uploaders.size - 1 %> <% else -%> <%= field %>: build_assets(params.<%= field %>)<%= ',' if index < @uploaders.size - 1 %> <% end -%> <% end -%> } end private def build_assets(assets) assets.to_a.map { |asset| Rails.application.routes.url_helpers.polymorphic_url(asset) rescue '' }.compact end <% end -%> end