Sha256: 03f5c657d0170303539b2e62271e748d2009c59ee519ca42ed3fc230a5e1993b
Contents?: true
Size: 802 Bytes
Versions: 5
Compression:
Stored size: 802 Bytes
Contents
# 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
Version data entries
5 entries across 5 versions & 1 rubygems