Space Character in Textbox


Development is done using InstantRails on a Windows Machine and MySQL
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):


27: Supervisor
28: <%= collection_select(“employee”, “supervisor_id” ,
@employees, “id”, “display_name”) %>

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 ?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs