Skip to content

Instantly share code, notes, and snippets.

@Hasstrup
Created November 5, 2024 21:27
Show Gist options
  • Save Hasstrup/243ea5484621243f9cb51005be2508dd to your computer and use it in GitHub Desktop.
Save Hasstrup/243ea5484621243f9cb51005be2508dd to your computer and use it in GitHub Desktop.
# frozen_string_literal: true
class Templates::Templates::CreateInput < BaseInput
REQUIRED_KEYS = %i[title file_name file_base64 user_id]
attributes(*REQUIRED_KEYS)
def validate!
validate_required_keys!
validate_user!
end
private
def validate_user!
within_error_context do
validate_association!(user_id, User)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment