Here are some random Rails tips I’ve found useful:
- rails console sandbox – if you open console like this it will rollback all database changes once you exit. Pretty useful for playing around without making any changes to database.
- rake db:migrate:status – useful when you want to see the status of current database. It will show the status of all migrations.
- User.pluck(:email) – since Rails 3.2.1 you can use pluck method to get an array of values in one particular column. It’s the equvivalent of doing User.select(:email).map(&:email)