mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
parent
d3adfd6d3b
commit
fa18c61153
4 changed files with 13 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
require 'cases/helper'
|
||||
require 'models/topic'
|
||||
require 'models/person'
|
||||
require 'models/traffic_light'
|
||||
require 'bcrypt'
|
||||
|
||||
class SerializedAttributeTest < ActiveRecord::TestCase
|
||||
|
@ -234,4 +235,10 @@ class SerializedAttributeTest < ActiveRecord::TestCase
|
|||
person = person.reload
|
||||
assert_equal(insures, person.insures)
|
||||
end
|
||||
|
||||
def test_regression_serialized_default_on_text_column_with_null_false
|
||||
light = TrafficLight.new
|
||||
assert_equal [], light.state
|
||||
assert_equal [], light.long_state
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,3 +4,7 @@ uk:
|
|||
- Green
|
||||
- Red
|
||||
- Orange
|
||||
long_state:
|
||||
- "Green, go ahead"
|
||||
- "Red, wait"
|
||||
- "Orange, caution light is about to switch"
|
|
@ -1,3 +1,4 @@
|
|||
class TrafficLight < ActiveRecord::Base
|
||||
serialize :state, Array
|
||||
serialize :long_state, Array
|
||||
end
|
||||
|
|
|
@ -685,6 +685,7 @@ ActiveRecord::Schema.define do
|
|||
create_table :traffic_lights, :force => true do |t|
|
||||
t.string :location
|
||||
t.string :state
|
||||
t.text :long_state, :null => false
|
||||
t.datetime :created_at
|
||||
t.datetime :updated_at
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue