You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
521 B

class Admin::AttachmentsController < Admin::AdminController
before_action :set_attachable_for, only: %i[ new ]
def new
@attachments = []
if params[:asset_ids]
Asset.where(id: params[:asset_ids].split(',')).each do |asset|
@attachments << @attachable_for.attachments.new(asset: asset)
end
else
@attachments << @attachable_for.attachments.new
end
end
private
def set_attachable_for
@attachable_for = Node.find(params[:node_id]) if params[:node_id]
end
end