Space Character in Textbox


Background: Development is done using InstantRails on a Windows Machine and MySQL Database. Production environment is a Debian server running a mongrel cluster w/ apache, connected to a MSSQL 2005 database server.

*** This only happens in production ***

  I'm having problem on our production app where when model has several validating text fields. The columns are nullable in the database. The value of the string field is initially NULL in the database. When the model is edited and saved, an empty string is written to the database. Then when I go to edit the model again, the text field in the html form has a value of " ". Somehow this breaks my app with an error message totally unrelated:

undefined method `inject' for nil:NilClass

Extracted source (around line #28):

25: 26: <tr> 27: <td><label for="employee_supervisor">Supervisor</label></td> 28: <td><%= collection_select("employee", "supervisor_id" , @employees, "id", "display_name") %></td> 29: </tr> 30: 31: <tr>

If I edit the model again, and just delete the " " value so it's an empty string, the save works fine. Why is ActiveRecord putting a space character into the text field instead of an empty string?

Does anyone have any help /pointers / experience with MSSQL ?

Thanks, Kevin