From 98ebd17df7c2f2a81a4945736d5ade2d652eaadf Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Tue, 16 Jun 2015 03:27:10 +0200 Subject: [PATCH] skip validation if table does not exist --- lib/diaspora_federation.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/diaspora_federation.rb b/lib/diaspora_federation.rb index 710ec1f..e480172 100644 --- a/lib/diaspora_federation.rb +++ b/lib/diaspora_federation.rb @@ -60,10 +60,15 @@ module DiasporaFederation def validate_class(klass, name, methods) raise ConfigurationError, "missing #{name}" unless klass - const = const_get(klass) + entity = const_get(klass) + + return logger.warn "table for #{entity} doesn't exist, skip validation" unless entity.table_exists? + methods.each {|method| - valid = const.respond_to?(method) || const.column_names.include?(method.to_s) || const.method_defined?(method) - raise ConfigurationError, "the configured class #{const} for #{name} does not respond to #{method}" unless valid + valid = entity.respond_to?(method) || + entity.column_names.include?(method.to_s) || + entity.method_defined?(method) + raise ConfigurationError, "the configured class #{entity} for #{name} doesn't respond to #{method}" unless valid } end end