Skip to content

Instantly share code, notes, and snippets.

@dmilisic
dmilisic / sales_processing.md
Last active February 9, 2021 14:36
5. Sales processing design challenge - Homework

Sales processing design challenge

Domains (bounded contexts)

  • Products
  • Sales
  • Contracts
  • Commissions
  • Payments
@dmilisic
dmilisic / active_record_enum_with_rails_admin.rb
Last active January 21, 2022 10:50
Initializer for handling ActiveRecord (4.1+) enums by RailsAdmin (0.6.2)
module ActiveRecord
module RailsAdminEnum
def enum(definitions)
super
definitions.each do |name, values|
define_method("#{ name }_enum") { self.class.send(name.to_s.pluralize).to_a }
define_method("#{ name }=") do |value|
if value.kind_of?(String) and value.to_i.to_s == value