Tag: ruby on rails tutorial: learn web development with rails

Rails built-in validators

All Rails built-in validators populate the details hash with the appropriate validator type. errors[:base] You can add error messages that refer to the state of the object as a whole rather than to a single attribute. This method can be used if you want to say that an object is invalid, regardless of the values […]

Modifying Existing Migrations in Ruby

Periodically, you will make mistakes when writing migrations. If you’ve already run a migration, you can’t just edit the migration and run it again: Rails will assume it has already run a migration and will do nothing when you run rails db:migrate. You must rollback the migration (using bin/rails db:rollback, for example), edit the migration, […]