How do i set the boolean value true

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?

Ishara G. wrote:

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

try this

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

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

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

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs