* Shandy Nantz, 2008-12-20, 07:27: > I have these years that I am trying to compare to see if they are > equal and when my code get to the right year in question where it is > supposed to equate to true, it doesn't. Here is my code: > > <% 1900.upto(year) do |i| %> > <%= option_tag(i, i, @user.dobyear.to_s == i.to_s ? true : false) %> > <% end %> > > When I do some 'puts' I get a condition where '1978' == '1978' and > that results in a false value and I can't figure out why. Why in Ruby > does this happen? It does not (checked). I suppose that the value of @user.dobyear only looks as if it were '1978' while in fact it contains some non-print character. Try 'p' to verify. And consider removing the ternary operator abuse. It makes not too much sense to have it results in true (false) if @user.dobyear.to_s == i.to_s is true (false); I think using the truth value proper is the variant one should prefer. Josef 'Jupp' Schugt -- Blog: http://penpen.goodaddress.eu/ (n/a atm) PGP key (id 6CC6574F): http://wwwkeys.de.pgp.net/ Jabber - http://www.jabber.org/ - contact information on request