Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix table comment dumping #26753

Merged
merged 1 commit into from
Oct 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ def new_column(*args) # :nodoc:
end

def table_options(table_name) # :nodoc:
{ comment: table_comment(table_name) }
if comment = table_comment(table_name)
{ comment: comment }
end
end

# Returns a comment stored in database for given table
Expand Down
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/schema_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def foreign_keys(table, stream)
end

def format_options(options)
options.map { |key, value| "#{key}: #{value.inspect}" if value }.compact.join(", ")
options.map { |key, value| "#{key}: #{value.inspect}" }.join(", ")
end

def remove_prefix_and_suffix(table)
Expand Down
1 change: 1 addition & 0 deletions activerecord/test/cases/schema_dumper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def test_schema_dump
output = standard_dump
assert_match %r{create_table "accounts"}, output
assert_match %r{create_table "authors"}, output
assert_no_match %r{(?<=, ) do \|t\|}, output
assert_no_match %r{create_table "schema_migrations"}, output
assert_no_match %r{create_table "ar_internal_metadata"}, output
end
Expand Down