skip validation if table does not exist
This commit is contained in:
parent
827aac03cf
commit
98ebd17df7
1 changed files with 8 additions and 3 deletions
|
|
@ -60,10 +60,15 @@ module DiasporaFederation
|
||||||
|
|
||||||
def validate_class(klass, name, methods)
|
def validate_class(klass, name, methods)
|
||||||
raise ConfigurationError, "missing #{name}" unless klass
|
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|
|
methods.each {|method|
|
||||||
valid = const.respond_to?(method) || const.column_names.include?(method.to_s) || const.method_defined?(method)
|
valid = entity.respond_to?(method) ||
|
||||||
raise ConfigurationError, "the configured class #{const} for #{name} does not respond to #{method}" unless valid
|
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
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue