File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,16 @@ class SpecificSchemaTestSqlserver < ActiveRecord::TestCase
9191 end
9292
9393 end
94+
95+ context 'with column names that have spaces' do
96+
97+ should 'create record using a custom attribute reader and be able to load it back in' do
98+ value = 'Saved value into a column that has a space in the name.'
99+ record = @edge_class . create! :with_spaces => value
100+ assert_equal value , @edge_class . find ( record . id ) . with_spaces
101+ end
102+
103+ end
94104
95105 context 'with description column' do
96106
Original file line number Diff line number Diff line change @@ -54,6 +54,12 @@ class StringDefault < ActiveRecord::Base; end
5454class SqlServerEdgeSchema < ActiveRecord ::Base
5555 attr_accessor :new_id_setting
5656 before_create :set_new_id
57+ def with_spaces
58+ read_attribute :'with spaces'
59+ end
60+ def with_spaces = ( value )
61+ write_attribute :'with spaces' , value
62+ end
5763 protected
5864 def set_new_id
5965 self [ :guid_newid ] ||= connection . newid_function if new_id_setting
Original file line number Diff line number Diff line change 8383 t . column :tinyint , :tinyint
8484 t . column :guid , :uniqueidentifier
8585 t . column 'crazy]]quote' , :string
86+ t . column 'with spaces' , :string
8687 end
8788 execute %|ALTER TABLE [sql_server_edge_schemas] ADD [guid_newid] uniqueidentifier DEFAULT NEWID();|
8889 execute %|ALTER TABLE [sql_server_edge_schemas] ADD [guid_newseqid] uniqueidentifier DEFAULT NEWSEQUENTIALID();| unless sqlserver_azure?
You can’t perform that action at this time.
0 commit comments