Ash FrameworkAF
Ash Framework3y ago
4 replies
5avage

action argument default to another argument?

Trying to use the value passed in one argument as a default value for a second argument. Is there a way? Something like:
  create :new_record do
    primary? true
    argument :short_name, :string, allow_nil?: false
    argument :long_name, :string, default: arg(:short_name)
    change set_attribute(:short_name, arg(:short_name))
    change set_attribute(:long_name, arg(:long_name))
  end


I've tried a few variations on the above and keep getting InvalidArgument compilation errors from Ash.
Was this page helpful?