ben
ben

Reputation: 29807

How do I add a default value to a field in a RoR migration?

How do I add a default value to an existing field in a RoR migration?

Upvotes: 1

Views: 242

Answers (1)

StefanOS
StefanOS

Reputation: 2748

I think this would do the trick

change_column :users, :active, :boolean, :default => 1

Use the same data type as when you created the column but add the default parameter.

Upvotes: 6

Related Questions