Hi All,

I have a column type of boolean, and when the value in that column is
set to 'false' (eg. 0 for MySQL), it returns nil.

I have tested this in the console, and it doesn't exhibit this
behavior there, only when running on Mongrel.

I tried wrapping the accessor call to intercept a nil and set it to
false for that attribute, but it doesn't seem to be working. For
Example:

  def needs_sound
    #ActiveRecord uses method_missing to implement DB accessors, so we
call super
    #to make it access the database.
    res = super
    if res == nil
      return false
    end
    return res
  end

The debugger says that 'res' is nil, but it ignores the conditional
and returns 'res' anyway. I have tried the conditional as a
'res.nil?', 'res==nil', 'super == nil'.

Any help would be greatly appreciated. This is occurring for all
boolean attributes when their value is false. Thanks,

Chris

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to