Re: [Rails] Built in (boolean)? method

2011-06-06 Thread Colin Law
On 6 June 2011 19:01, Ants Pants wrote: > > Colin, to answer your earlier question about whether I had a method > overriding one of the attribute calls ... Just for the record I can't claim the prize for that call, it was Chris Kottom. Colin -- You received this message because you are subscri

Re: [Rails] Built in (boolean)? method

2011-06-06 Thread Ants Pants
On 5 June 2011 22:53, Colin Law wrote: > On 5 June 2011 21:35, Chris Mear wrote: > > < loads of useful and interesting stuff.> > > What a great list, ask some questions and get excellent answers. Thanks > Chris. > > Colin > > -- > You received this message because you are subscribed to the Goo

Re: [Rails] Built in (boolean)? method

2011-06-05 Thread Colin Law
On 5 June 2011 21:35, Chris Mear wrote: > < loads of useful and interesting stuff.> What a great list, ask some questions and get excellent answers. Thanks Chris. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this

Re: [Rails] Built in (boolean)? method

2011-06-05 Thread Chris Mear
On 5 June 2011 10:15, Colin Law wrote: > I have never used the for_charity? syntax though.  There does not seem > much point when it is a boolean. I've been using it ever since reading dire warnings in the first edition of Agile Web Development with Rails: "[To represent true or false, some dat

Re: [Rails] Built in (boolean)? method

2011-06-05 Thread Chris Kottom
Sorry, I misunderstood the original message. Ran similar tests in my local environment with same Ruby / Rails, and wasn't able to get a similar outcome. Is there anything in your model that could be overriding the dynamically created accessor? On Sun, Jun 5, 2011 at 9:55 AM, Ants Pants wrote: >

Re: [Rails] Built in (boolean)? method

2011-06-05 Thread Colin Law
On 4 June 2011 07:47, Ants Pants wrote: > When creating a boolean attribute in ActiveRecord, you get a ? method for > free. Sadly, it's returning false for a true value. Does anyone know what > might be going on? > From my console (for_charity: true). Same behaviour on Rails 2.3.8 and > 2.3.11 > r

Re: [Rails] Built in (boolean)? method

2011-06-05 Thread Ants Pants
i know about the storage issue (or at least I thought I did) but what I am saying is that the returned values are different between the attribute for_charity and for_charity? Surely that has nothing to do with how the values are stored? I sent the output form console in my original email to show t

Re: [Rails] Built in (boolean)? method

2011-06-04 Thread Chris Kottom
The actual representation of any attribute type in Rails will depend on the underlying DBMS as the mapping changes from platform to platform. But if we assume we're talking about SQLite as an example, it uses a SQLite boolean which is actually stored as 0 for FALSE or 1 for TRUE, and both of these

[Rails] Built in (boolean)? method

2011-06-03 Thread Ants Pants
When creating a boolean attribute in ActiveRecord, you get a ? method for free. Sadly, it's returning false for a true value. Does anyone know what might be going on? >From my console (for_charity: true). Same behaviour on Rails 2.3.8 and 2.3.11 ruby-1.8.7-p302 > m.for_charity? => false ruby-1.8