brick 1.0.27 → 1.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '097fb194c2b1323cd051669f362d86492d9c768f1cbccf06c2fdc45a7f266e1e'
4
- data.tar.gz: 72746f153d073256b8be063e90c28da85a50e11865250f2570d501ff320431b3
3
+ metadata.gz: ad31136f451e04eabcc67ee09980d45d25aa8e35453aaf4c160ffc9aef3f774c
4
+ data.tar.gz: 5e3b705dfad389391b291d26bd3c0571cf0579abce3ed00c2840805fd5e05353
5
5
  SHA512:
6
- metadata.gz: 83d0c40c0af17d314d6b4cd7ab0e312bce1c8d57bdd0992da1b54fa8a3e829852c6fd800c34f3bd35f3a3306bda736dc99d14af19009926bf65971a5d4904717
7
- data.tar.gz: c82b9c31ffe3a00e701e22a3f69c85e7b60e0b3b6d24e95df7fe3f8afb85b00ab7515e0befab7dd37e8a25924274e663127b953dab8eb64041d834aa39de4bc1
6
+ metadata.gz: ac2403152cae57e54ae1840920aa47e5c64297ff7698f691c0a752ae063d824073f24d040aa66580ef0e5eddac0ec164cf720bc720ad73a09ef7862116608476
7
+ data.tar.gz: b529668cde573b3c371af30b7f141a1e313d477281bc2ef5453c9751a67abea39a4d8a57e3632f6ef8789ea04ab9d4e01170fb29f096fa6ab8772df77f60f564
data/lib/brick/config.rb CHANGED
@@ -122,12 +122,32 @@ module Brick
122
122
  @mutex.synchronize { @sti_namespace_prefixes = prefixes }
123
123
  end
124
124
 
125
- def schema_to_analyse
126
- @mutex.synchronize { @schema_to_analyse }
125
+ def schema_behavior
126
+ @mutex.synchronize { @schema_behavior ||= {} }
127
127
  end
128
128
 
129
- def schema_to_analyse=(schema)
130
- @mutex.synchronize { @schema_to_analyse = schema }
129
+ def schema_behavior=(schema)
130
+ @mutex.synchronize { @schema_behavior = schema }
131
+ end
132
+
133
+ def sti_type_column
134
+ @mutex.synchronize { @sti_type_column ||= {} }
135
+ end
136
+
137
+ def sti_type_column=(type_col)
138
+ @mutex.synchronize do
139
+ (@sti_type_column = type_col).each_with_object({}) do |v, s|
140
+ if v.last.nil?
141
+ # Set an STI type column generally
142
+ ActiveRecord::Base.inheritance_column = v.first
143
+ else
144
+ # Custom STI type columns for models built from specific tables
145
+ (v.last.is_a?(Array) ? v.last : [v.last]).each do |table|
146
+ ::Brick.relations[table][:sti_col] = v.first
147
+ end
148
+ end
149
+ end
150
+ end
131
151
  end
132
152
 
133
153
  def default_route_fallback