Four Days with Rails Issue


#1

Hi, I’m trying to get through the popular “Four Days with Rails”
tutorial and am experiencing some problem with the “Priority” of the
item. Right from the start, RoR seems to want to consider it as a value
that must be boolean. The scaffolded code asks for “True/ False” as the
input.

PHPMyAdmin shows that the database thinks it should be an unsigned
TinyInt with a default value of 3. But, RoR seems to be confused about
it. As a result, the validation fails (cos it seems to be checking for
a “true/ false” value :in=>1…5 and does not succeed). I finally
removed the validation since it was failing and tried again. It now
adds a record with Priority = “true”.

Any idea what I should look for? Sorry if more information is needed -
just ask :slight_smile:

Thanks
Mohit.


#2

Mohit S. wrote:

finally removed the validation since it was failing and tried again.
It now adds a record with Priority = “true”.

Any idea what I should look for? Sorry if more information is needed

  • just ask :slight_smile:

Thanks
Mohit.

OK, it’s probably bad manners to reply to my own mail! :slight_smile:
But, I just changed the database structure for the item to hold the
priority in a “SmallInt” instead of a “TinyInt” and everything seems to
be fine and works OK. RoR scaffold code works fine (almost… it now has
a problem with validating the Done field) but the priority is fine. The
modified part (code modified after the scaffold was generated) works
perfectly.

But, can anyone clarify my understanding that RoR seems to think that a
TinyInt is a boolean value?

Cheers
Mohit.

p.s. Sorry that I did a reply to my mail rather than to the list - my
server (or the list server) seems to be facing a problem and I’m
receiving emails from 12 hours back only now!
p.p.s Apologies also for the reply that I sent right now to an email
from about 12 hours back - perhaps, someone had already responded :stuck_out_tongue: