assuming 0 as false and 1 as true. Try it out
confirm_client=ConfirmClient.find(5) # I am supposing the client with
id 5
if confirm_client.confirm==1 #yes indeed this client is verified
do_something
else #not verified client
do_something_else probably redirect to some place with
flash[:notice]
end
assuming 0 as false and 1 as true. Try it out
confirm_client=ConfirmClient.find(5) # I am supposing the client with
id 5
How true/false are represented in the DB is database dependant. You
don't need to worry about that though - confirm_client.confirm is
typecasted by rails to either true or false no matter what the
underlying column stores (t/f, 0/1, Y/N etc...)
assuming 0 as false and 1 as true. Try it out
confirm_client=ConfirmClient.find(5) # I am supposing the client with
id 5
How true/false are represented in the DB is database dependant. You
don't need to worry about that though - confirm_client.confirm is
typecasted by rails to either true or false no matter what the
underlying column stores (t/f, 0/1, Y/N etc...)
Fred
But, I've found that you almost always want to replace:
t.column :confirm, :boolean
with
t.column :confirm, :boolean, :default => false, :null => false
Unless you need the SQL NULL to mean something other than "not true" (because it is also "not false")