Hi, Just upgraded to Rails 0.12.0 and ActionWebService 0.7. I''m using the special struct class to create custom structs. In version 0.6.2 I was able to receive nil values for members of the struct. As of version 0.7 all nil values seem to be rewritten to some default value (empty string for string member, 0 for int etc.), which breaks my application. Is this a bug or a feature? Shouldn''t it be possible to just receive nil values? Regards, Peter
Peter C. Verhage wrote:> Just upgraded to Rails 0.12.0 and ActionWebService 0.7. I''m using the > special struct class to create custom structs. In version 0.6.2 I was > able to receive nil values for members of the struct. As of version 0.7 > all nil values seem to be rewritten to some default value (empty string > for string member, 0 for int etc.), which breaks my application. Is this > a bug or a feature? Shouldn''t it be possible to just receive nil values?Found a fix: In the file casting.rb I added the following line in the cast method: return nil if value.nil? Just after: return value if signature_type.nil? # signature.length != params.length Is this the proper fix? Regards, Peter
On 4/20/05, Peter C. Verhage <peter-ZfV/+zpN0l5SNv8qJpUclg@public.gmane.org> wrote:> Peter C. Verhage wrote: > > Just upgraded to Rails 0.12.0 and ActionWebService 0.7. I''m using the > > special struct class to create custom structs. In version 0.6.2 I was > > able to receive nil values for members of the struct. As of version 0.7 > > all nil values seem to be rewritten to some default value (empty string > > for string member, 0 for int etc.), which breaks my application. Is this > > a bug or a feature? Shouldn''t it be possible to just receive nil values?Hi Peter, This is indeed a regression since 0.11, thanks for picking up on this.> return nil if value.nil?This fix appears to be correct, since it is a struct casting behaviour change in 0.12 that is the cause. Thanks! Committed. Leon
Peter C. Verhage wrote:> Hi, > > Just upgraded to Rails 0.12.0 and ActionWebService 0.7. I''m using the > special struct class to create custom structs. In version 0.6.2 I was > able to receive nil values for members of the struct. As of version 0.7 > all nil values seem to be rewritten to some default value (empty string > for string member, 0 for int etc.), which breaks my application. Is this > a bug or a feature? Shouldn''t it be possible to just receive nil values?This has bitten me as well: My act_as_tree models return ''self'' for parent when parent_id iss 0 (which is not backed up by an actual account).