millions-exabyte-27721
03/31/2025, 9:13 AMmillions-exabyte-27721
03/31/2025, 9:15 AMmillions-exabyte-27721
03/31/2025, 9:16 AMloud-jewelry-99127
03/31/2025, 9:22 AMmillions-exabyte-27721
03/31/2025, 9:22 AMloud-jewelry-99127
03/31/2025, 9:22 AMloud-jewelry-99127
03/31/2025, 9:23 AMloud-jewelry-99127
03/31/2025, 9:24 AMloud-jewelry-99127
03/31/2025, 9:28 AMruby
class Avo::Actions::Import < Avo::BaseAction
self.name = "Import"
self.standalone = true
def fields
field :csv, as: :file
end
def handle(fields:, **args)
csv_data = fields[:csv].tempfile
CSV.foreach(csv_data, headers: true) do |row|
# Access each column by its header name
puts "Name: #{row['Name']}"
# etc. – depends on your CSV headers
end
end
endmillions-exabyte-27721
03/31/2025, 11:09 AMtextarea, which is enough for now
but I thought, maybe this would be stuff for another guide?loud-jewelry-99127
03/31/2025, 11:11 AMmillions-exabyte-27721
03/31/2025, 11:25 AMloud-jewelry-99127
03/31/2025, 11:27 AMdef handle and checked fields[:csv] class
Then I asked GPT how to get file from that object and iterate rowsloud-jewelry-99127
03/31/2025, 11:27 AMmillions-exabyte-27721
04/23/2025, 7:07 AMfile field:
rb
class Avo::Actions::ImportUsers < Avo::BaseAction
self.name = "Import Users"
self.standalone = true
# self.visible = -> do
# true
# end
def fields
field :file, as: :file
end
def handle(query:, fields:, current_user:, resource:, **args)
query.each do |record|
# Do something with your records.
end
end
end
but the dialog doesn't give me an upload field:
https://cdn.discordapp.com/attachments/1356194718861496361/1364497974608269333/image.png?ex=6809e344&is=680891c4&hm=d20c209d5f8256ac6c72bb79ff281fbee76ef9a4c3c8301750615d2ac9b0b775&
https://cdn.discordapp.com/attachments/1356194718861496361/1364497974889156722/image.png?ex=6809e344&is=680891c4&hm=b6fa852657425b8a1d07af22b7be661d9c23fc99b7a24ccbe2d14235c0b12617&millions-exabyte-27721
04/23/2025, 7:08 AMmillions-exabyte-27721
04/23/2025, 7:11 AMmillions-exabyte-27721
04/23/2025, 7:12 AMloud-jewelry-99127
04/23/2025, 10:25 AMloud-jewelry-99127
04/23/2025, 10:25 AMloud-jewelry-99127
04/23/2025, 10:26 AMupload_file? = truemillions-exabyte-27721
04/23/2025, 10:34 AMmillions-exabyte-27721
04/23/2025, 10:34 AMmillions-exabyte-27721
04/23/2025, 10:34 AMloud-jewelry-99127
04/23/2025, 10:36 AMmillions-exabyte-27721
04/23/2025, 11:03 AMUser resourcemillions-exabyte-27721
04/23/2025, 11:03 AMrb
def actions
action Avo::Actions::ImportUsers
endloud-jewelry-99127
04/23/2025, 1:01 PMupload_file? = true should go inside the UserResourceloud-jewelry-99127
04/23/2025, 1:05 PMmillions-exabyte-27721
04/23/2025, 1:29 PM