Skip to content

Commit

Permalink
Ok, fuckit: re-introduce method_missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim Altintop committed Jun 22, 2011
1 parent 4c26815 commit df5653b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/master_slave_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,18 @@ def execute(*args)
:truncate_table, # monkeypatching database_cleaner gem
:primary_key, # is Base#primary_key meant to be the contract?
:to => :master_connection
# ok, we might have missed more
def method_missing(name, *args, &blk)
master_connection.send(name.to_sym, *args, &blk).tap do
warn %Q{
You called the unsupported method '#{name}' on #{self.class.name}.
In order to help us improve master_slave_adapter, please report this
to: https://github.com/soundcloud/master_slave_adapter/issues
Thank you.
}
end
end

# === determine read connection
delegate :select_all,
Expand Down Expand Up @@ -352,6 +364,10 @@ def info(msg)
logger.try(:info, msg)
end

def warn(msg)
logger.try(:warn, msg)
end

def debug(msg)
logger.debug(msg) if logger && logger.debug?
end
Expand Down

0 comments on commit df5653b

Please sign in to comment.