I''m finding my boolean mysql fields are being interpreted as integers by active record.. there''s a feature request here regarding it that someone posted: http://dev.rubyonrails.com/ticket/227 It''s listed as closed, but even using the newest version I''m getting 1s and 0s instead of true or false.. Any ideas? Thanks in advance
You should add a question mark to the accessor method name, so if your db has a tinyint field checked, you need to call @myobject.checked?. The method is created automatically by rails, you can just start using it. //jarkko On 30.3.2005, at 12:07, Luke Galea wrote:> I''m finding my boolean mysql fields are being interpreted as integers > by > active record.. there''s a feature request here regarding it that > someone > posted: http://dev.rubyonrails.com/ticket/227 > > It''s listed as closed, but even using the newest version I''m getting > 1s and 0s > instead of true or false.. Any ideas? > > Thanks in advance > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Wed, 30 Mar 2005 09:07:46 +0000, Luke Galea <luke.galea-bJEeYj9oJeDQT0dZR+AlfA@public.gmane.org> wrote:> I''m finding my boolean mysql fields are being interpreted as integers by > active record.. there''s a feature request here regarding it that someone > posted: http://dev.rubyonrails.com/ticket/227 > > It''s listed as closed, but even using the newest version I''m getting 1s and 0s > instead of true or false.. Any ideas? >http://wiki.rubyonrails.com/rails/show/HowtoUseBooleanColumns
Perfect! Thanks. I guess another question is: Why doesn''t scaffolding default to using the question marked method if it exists? On Wednesday 30 March 2005 15:14, Jarkko Laine wrote:> You should add a question mark to the accessor method name, so if your > db has a tinyint field checked, you need to call @myobject.checked?. > The method is created automatically by rails, you can just start using > it. > > //jarkko > > On 30.3.2005, at 12:07, Luke Galea wrote: > > I''m finding my boolean mysql fields are being interpreted as integers > > by > > active record.. there''s a feature request here regarding it that > > someone > > posted: http://dev.rubyonrails.com/ticket/227 > > > > It''s listed as closed, but even using the newest version I''m getting > > 1s and 0s > > instead of true or false.. Any ideas? > > > > Thanks in advance > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > -- > Jarkko Laine > http://jlaine.net > http://odesign.fi