This project is archived and is in readonly mode.
Serialize saves false boolean value as string "f" in sqlite3
-
Aditya Sanghi
- State changed from new to open
- Importance changed from to Low
I can see this happen on 1.8.7. I also see that false gets serialized to 0 with mysql adapter.
-
Aditya Sanghi
On Rails master (will need to do work on Rails 3 stable branch a bit later) -
On Rails master, i see the behavior is that boolean false is actually saved as nil.
I think the problem is this line of code
if value && self.class.serialized_attributes.key?(name) value = YAML.dump value endThis makes sure that "values" that are set to false are never really YAML.dumped.
Will work on patch and failing test.
-
Aditya Sanghi
- Milestone set to 3.x
- Assigned user set to José Valim
- Tag changed from activerecord rails3, serialize, sqlite3 to activerecord rails3, patch, serialize, sqlite3
- Importance changed from Low to Medium
Adding patch for master to deal with attributes assigned as false to be serialized properly.
Now working on 3.0.x branch.
-
José Valim
- Assigned user changed from José Valim to Aaron Patterson
-
Aditya Sanghi
- Milestone cleared.
- Assigned user changed from Aaron Patterson to José Valim
And adding patch for 3-0 stable as well.
-
Aditya Sanghi
- Assigned user changed from José Valim to Aaron Patterson
-
Repository
- State changed from open to resolved
(from [97e9d8860b277e5ca9f4187c213ddd35d7f76e9b]) Ensure that boolean false is properly serialized [#6079 Serialize saves false boolean value as string "f" in sqlite3 state:resolved] https://github.com/rails/rails/commit/97e9d8860b277e5ca9f4187c213dd...
-
Repository
(from [7a237d56aa38c51987af0fd52d001989c4f3da07]) Ensure that boolean false is properly serialized [#6079 Serialize saves false boolean value as string "f" in sqlite3 state:resolved] https://github.com/rails/rails/commit/7a237d56aa38c51987af0fd52d001...
