How do i set the boolean value true


#1

i have seperate tables called “messages” and “replies”
in messages,attributes are
t.column :user_id, :string
t.column :msg_id, :string
t.column :inbox, :boolean
t.column :sent, :boolean

in repliest, attributes are
t.column :user_id, :string
t.column :msg_id, :string
t.column :name, :string
t.column :address, :string

when a user filled a form the name and address will be save
on replies table.at that instance i want to set the value true
in the sent column of the messages table. how can i do this?


#2

Ishara G. wrote:

i have seperate tables called “messages” and “replies”
t.column :sent, :boolean

try this

t.column :sent, :boolean ,:default=>true


#3

no,i don’t want to set that variable always true,i just want to set it
true
when the user filled the form.


#4

Ishara G. wrote:

no,i don’t want to set that variable always true,i just want to set it
true
when the user filled the form.

try
after_save in Reply Model


#5

record.sent = true if (params[:checked] == “1”) #if the user checks it.
Add that line before saving.
Ishara G. wrote:

no,i don’t want to set that variable always true,i just want to set it
true
when the user filled the form.