(no title)
drzel | 3 months ago
plans = {
1.month => {standard: 10, pro: 50, enterprise: 100},
1.year => {standard: 100, pro: 500, enterprise: 1000}
}
plans.each do |interval, details|
details.each do |name, amount|
Billing::Plan::Factory.find_or_create_by!(name: , interval:, amount:)
end
end
bradly|3 months ago
Also ActiveSupport has Object#with_options which has a similar intent, but I rarely ever see it used in codebases.
Footkerchief|3 months ago