I have a boolean column that I would like to modify with a select
helper element, and have :include_blank map to (database) null.

This *almost* works.  On the create/edit/update page, if you select
true/yes it sets the column to true, if you select No/false it sets it
to false, and if you set it to blank, it sets it to (database) null.
fantastic.

Now you edit the record.  If it is "True" in the database the select
box picks the correct value.  If it was set to 'no' or (database)null
however the selection is set to the blank value.

This is especially problematic if you edit any other field on the
form, as it resets *everything* back to 'null', regardless of if it
was "false" or "null" to beginwith.

I have constructed a trivial test application to demonstrate this:

http://www.cs.rpi.edu/~crossd/selecttest.tar.bz2

Fire it up in 'rails server' and go to http://127.0.0.1:3000/testings

(I've included a sqlite3 db there with 2 rows in it).  edit one, set
it to 'Yes', check the 'show' page, edit it again, set it to 'No',
check the 'show' page, edit it again, set it to blank (you won't have
to, its already there), and save it and check the show page. notice
all 3 edits work correctly, but the initial value is NOT set correctly
for for the 'False' case.

Is this a bug? am I doing something wrong?
--
David E. Cross

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to