Found a silly bug in YAML Fixtures.

Hi,

In fixtures, whenever I define a string as "yes", it is stored as "t"
in the database.

Here is an example in YAML.

active_user:
  username: active_user
  is_active: yes

Now when I run the test, and check the test database (SQLite), I find
string "t" stored in place of "yes" for the column "is_active".

Now consider following example (changed "yes" to "yup") -

active_user:
  username: active_user
  is_active: yup

Now everything goes as expected and string "yup" is stored in database
for column "is_active".

In my code, I use `User.is_active == "yes"`, to check that an user is
active. And any other value for is_active means user is inactive.

It took me almost four hours to identify why my tests are failing!

Later found that string "true" is also stored as "t" in database. and
"no" is stored as "f".

I'm using -
Rails 2.0.2
SQLite 3.5.7
Ruby 1.8.6 (patch 111)
Microsoft Winodws XP Home Edtn. SP2

Oops just discovered that this is the problem in YAML and not in
rails.
Anyway this should be considered as a bug and not a feature.
reference - http://wiki.rubyonrails.org/rails/pages/ActiveRecordYamlFixtures

Oops just discovered that this is the problem in YAML and not in
rails.
Anyway this should be considered as a bug and not a feature.
reference - http://wiki.rubyonrails.org/rails/pages/ActiveRecordYamlFixtures

This is intentional. Instead of checking foo.is_active == 'blah', use
foo.is_active?
If you do want to stop yaml guessing that you're trying to store a
boolean, quote it (ie "yes")
Fred