Here’s how you should do it:
change_column :users, :admin, :boolean, :default => false
But some databases, like PostgreSQL, will not update the field for rows previously created, so make sure you update the field manaully on the migration too.
More Related Contents:
- Using Rails Migration on different database than standard “production” or “development”
- Run a single migration file
- Adding foreign key to a rails model
- Format a string containing Phone numbers
- SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
- How to understand nil vs. empty vs. blank in Ruby
- redirect_to using POST in rails
- Rails 4: List of available datatypes
- ActiveRecord.find(array_of_ids), preserving order
- In Ruby on Rails, how do I format a date with the “th” suffix, as in, “Sun Oct 5th”?
- How to create a deep copy of an object in Ruby?
- Rails: Access to current_user from within a model in Ruby on Rails
- What’s the best way to use SOAP with Ruby?
- How do you write a migration to rename an ActiveRecord model and its table in Rails?
- Rails update_attributes without save?
- how to solve “ruby installation is missing psych” error?
- Detect MIME type of uploaded file in Ruby
- How can I find out the current route in Rails?
- Using send_file to download a file from Amazon S3?
- How to use ActiveRecord in a ruby script outside Rails?
- Using helpers in model: how do I include helper dependencies?
- How to change the default path of view files in a Rails 3 controller?
- Rails I18n validation deprecation warning
- Converting an array of objects to ActiveRecord::Relation
- Rails each loop insert tag every 6 items?
- Validation failed: Upload file has an extension that does not match its contents
- Rails 3 invalid multibyte char (US-ASCII)
- 403 Forbidden on Rails app w/ Nginx, Passenger
- How do I remove lines of data in the middle of a text file with Ruby
- How to fix “Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5” while server starting