How to use alias_input with nested attributes #186
-
Hi. I have this code play ->(result) { result.client_id = result.campaign_booking.client_id },
... How to use I try with: alias_input(client_id: :campaign_booking[:client_id]), alias_input(client_id: :campaign_booking['client_id']), alias_input(client_id: :campaign_booking.client_id), But don't work. Any idea? Thanks! Sorry for my english. |
Beta Was this translation helpful? Give feedback.
Answered by
sunny
Feb 5, 2025
Replies: 2 comments
-
Hey @paulomcnally!
play ->(result) { result.client_id = result.campaign_booking.client_id },
... Is the shortest syntax you can have here. If you’re doing this same assignment over and over again, something you do very often you could always create a small actor that reassigns, e.g.: play AssignClientIdFromCampaignBooking,
... with: class AssignClientIdFromCampaignBooking < Actor
input :campaign_booking
output :client_id
def call
self.client_id = campaign_booking.client_id
end
end |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
paulomcnally
-
Thank you for your reply. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @paulomcnally!
alias_input
won’t help you there, so calling:Is the shortest syntax you can have here.
If you’re doing this same assignment over and over again, something you do very often you could always create a small actor that reassigns, e.g.:
with: