Skip to content

Commit b852cc6

Browse files
committed
add a version check
1 parent ef3d9d3 commit b852cc6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/schema_plus/core/schema_dump.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,12 @@ def assemble(stream, typelen, namelen)
105105
pr += ',' unless options.blank?
106106
stream.write "%-#{namelen+3}s " % pr
107107
end
108-
if options[:default].is_a?(Proc)
109-
default = options.delete(:default)
110-
stream.write "default: -> { \"#{default.call}\" }"
111-
stream.write ", " unless options.blank?
108+
if Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.0.0')
109+
if options[:default].is_a?(Proc) &&
110+
default = options.delete(:default)
111+
stream.write "default: -> { \"#{default.call}\" }"
112+
stream.write ", " unless options.blank?
113+
end
112114
end
113115
stream.write options.to_s.sub(/^{(.*)}$/, '\1') unless options.blank?
114116
stream.write ' ' unless options.blank? or comments.blank?

0 commit comments

Comments
 (0)