Forum: Ruby How can I set default value for each column in a Database?

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.
Zhao Y. (Guest)
on 2008-11-23 12:28
I created a database in my rails project and want to set default value
for each column. I have read the self.up method of the file
db\migrate\20081123094926_create_bay_infos.rb and thought that this is
where I need to modify. But I don't know how to do this.
Brian C. (Guest)
on 2008-11-23 12:53
Zhao Yi wrote:
> I created a database in my rails project and want to set default value
> for each column. I have read the self.up method of the file
> db\migrate\20081123094926_create_bay_infos.rb and thought that this is
> where I need to modify. But I don't know how to do this.

http://ar.rubyonrails.com/

Scroll down to "migrations", click "learn more"

Search for :default to see some examples

Note that Rails questions are best asked on a Rails mailing list or
group. This list is focussed on the Ruby programming language, not Rails
(which is an application/framework written *in* Ruby)
Zhao Y. (Guest)
on 2008-11-23 13:06
Brian C. wrote:
> Zhao Yi wrote:
>> I created a database in my rails project and want to set default value
>> for each column. I have read the self.up method of the file
>> db\migrate\20081123094926_create_bay_infos.rb and thought that this is
>> where I need to modify. But I don't know how to do this.
>
> http://ar.rubyonrails.com/
>
> Scroll down to "migrations", click "learn more"
>
> Search for :default to see some examples
>
> Note that Rails questions are best asked on a Rails mailing list or
> group. This list is focussed on the Ruby programming language, not Rails
> (which is an application/framework written *in* Ruby)

Oh sorry for posting to a wrong forum. Thanks.
This topic is locked and can not be replied to.