Skip to content

Instantly share code, notes, and snippets.

@Hasstrup
Created November 5, 2024 22:23
Show Gist options
  • Save Hasstrup/7cbfbec05bd293502ae4194ee2e4ebdf to your computer and use it in GitHub Desktop.
Save Hasstrup/7cbfbec05bd293502ae4194ee2e4ebdf to your computer and use it in GitHub Desktop.
class Templates::Component < ApplicationRecord
self.table_name = 'templates_components'
KEY_TYPE_APPLICATORS = {
invoices: %i[
issue_date
due_date
unit_price
total_hours
sub_total
total
]
}
belongs_to :template, class_name: 'Templates::Template'
validates :key_type, inclusion: { in: KEY_TYPE_APPLICATORS.values.flatten.map(&:to_s) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment