master_slave_adapter_soundcloud 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/master_slave_adapter.rb +21 -4
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/master_slave_adapter.rb
CHANGED
@@ -252,10 +252,23 @@ module ActiveRecord
|
|
252
252
|
:to => :master_connection
|
253
253
|
delegate *ActiveRecord::ConnectionAdapters::SchemaStatements.instance_methods,
|
254
254
|
:to => :master_connection
|
255
|
-
#
|
256
|
-
delegate :tables,
|
257
|
-
|
258
|
-
|
255
|
+
# no clear interface contract:
|
256
|
+
delegate :tables, # commented in SchemaStatements
|
257
|
+
:truncate_table, # monkeypatching database_cleaner gem
|
258
|
+
:primary_key, # is Base#primary_key meant to be the contract?
|
259
|
+
:to => :master_connection
|
260
|
+
# ok, we might have missed more
|
261
|
+
def method_missing(name, *args, &blk)
|
262
|
+
master_connection.send(name.to_sym, *args, &blk).tap do
|
263
|
+
warn %Q{
|
264
|
+
You called the unsupported method '#{name}' on #{self.class.name}.
|
265
|
+
In order to help us improve master_slave_adapter, please report this
|
266
|
+
to: https://github.com/soundcloud/master_slave_adapter/issues
|
267
|
+
|
268
|
+
Thank you.
|
269
|
+
}
|
270
|
+
end
|
271
|
+
end
|
259
272
|
|
260
273
|
# === determine read connection
|
261
274
|
delegate :select_all,
|
@@ -351,6 +364,10 @@ module ActiveRecord
|
|
351
364
|
logger.try(:info, msg)
|
352
365
|
end
|
353
366
|
|
367
|
+
def warn(msg)
|
368
|
+
logger.try(:warn, msg)
|
369
|
+
end
|
370
|
+
|
354
371
|
def debug(msg)
|
355
372
|
logger.debug(msg) if logger && logger.debug?
|
356
373
|
end
|