lib/evil_seed/root_dumper.rb in evil-seed-0.1.0 vs lib/evil_seed/root_dumper.rb in evil-seed-0.1.1
- old
+ new
@@ -21,10 +21,12 @@
# Generate dump and write it into +io+
# @param output [IO] Stream to write SQL dump into
def call
association_path = model_class.model_name.singular
- RelationDumper.new(model_class.where(*root.constraints), self, association_path).call
+ relation = model_class.all
+ relation = relation.where(*root.constraints) if root.constraints.any? # without arguments returns not a relation
+ RelationDumper.new(relation, self, association_path).call
end
# @return [Boolean] +true+ if limits are NOT reached and +false+ otherwise
def check_limits!(association_path)
check_total_limit! && check_association_limits!(association_path)