mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
parent
8f4ee48687
commit
3e8ab910ce
2 changed files with 10 additions and 2 deletions
|
@ -380,9 +380,9 @@ module ActiveRecord
|
|||
case field["dflt_value"]
|
||||
when /^null$/i
|
||||
field["dflt_value"] = nil
|
||||
when /^'(.*)'$/
|
||||
when /^'(.*)'$/m
|
||||
field["dflt_value"] = $1.gsub("''", "'")
|
||||
when /^"(.*)"$/
|
||||
when /^"(.*)"$/m
|
||||
field["dflt_value"] = $1.gsub('""', '"')
|
||||
end
|
||||
|
||||
|
|
|
@ -7,6 +7,14 @@ module ActiveRecord
|
|||
|
||||
self.use_transactional_fixtures = false
|
||||
|
||||
def test_add_column_newline_default
|
||||
string = "foo\nbar"
|
||||
add_column 'test_models', 'command', :string, :default => string
|
||||
TestModel.reset_column_information
|
||||
|
||||
assert_equal string, TestModel.new.command
|
||||
end
|
||||
|
||||
def test_add_remove_single_field_using_string_arguments
|
||||
refute TestModel.column_methods_hash.key?(:last_name)
|
||||
|
||||
|
|
Loading…
Reference in a new issue