Forum: Ruby on Rails how do i set the boolean value true

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ishara G. (Guest)
on 2008-10-30 05:34
(Received via mailing list)
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?
Thani A. (Guest)
on 2008-10-30 06:04
Ishara G. wrote:
> i have seperate tables called "messages" and "replies"
>       t.column :sent, :boolean

try this

   t.column :sent, :boolean ,:default=>true
Ishara G. (Guest)
on 2008-10-30 06:23
(Received via mailing list)
no,i don't want to set that variable always true,i just want to set it
true
when the user filled the form.
Thani A. (Guest)
on 2008-10-30 07:06
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
Naga harish K. (Guest)
on 2008-10-30 12:14
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 topic is locked and can not be replied to.