If you are like many (most?) of us, you have encountered Rails
Credentials/Secrets and secret_key_base
and may have been
left a bit (or more) confused.
This post is an attempt to remove some of that confusion by
# Given an array of arrays s = [ [1,2,3], [4,5,6], ... ] | |
# compute the Cartesian product among the elements of s. | |
require 'pp' | |
s = [[1, 2], [3, 4, 5], [6, 7, 8, 9]] | |
pp s[1..-1].inject(s[0]){ |m,v| m = m.product(v).map(&:flatten) } | |
[[1, 3, 6], | |
[1, 3, 7], | |
[1, 3, 8], |
# Activate the gem you are reporting the issue against. | |
gem 'activerecord', '4.2.6' | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
$logger = Logger.new(STDOUT) | |
# This connection will do for database-independent bug reports. | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') |