Keeping Ruby on Rails up to date:
Rails > 2.1 now with gem dependencies and here
ruby -v — check which version of ruby you have installed
rails -v — check which version of rails you have installed
gem list — check versions of all installed gems
sudo gem update — bulk update of all installed gems (some say this is a bad idea)
sudo gem update –system (updates rubygems, note use of double dash)
sudo gem uninstall <gem_name> — uninstall a specific gem
sudo gem install <gem_name> — install a specific gem
sudo gem cleanup — remove old versions of gems
sudo gem install -v=2.0.2 rails — install a specific version of Rails (to stay in synch with Dreamhost)
Rmagick
Installing Rmagick
sudo apt-get update
sudo apt-get install imagemagick
- Then, install the imagemagick9 dev library:
sudo apt-get install libmagick9-dev
- Last, install the RMagick gem:
sudo gem install rmagick
Rails Migrations
Use rake db:schema:load if having trouble with Rails migrations and you have a working schema.
Use rake db:migrate VERSION=3 to roll back to version 3
Use rake db:migrate:reset — drop db, recreate it, and then run all migrations
rake db:rollback — go back one migration
rake db:migrate:redo — undo last migration and then redo it
rake db:sessions:clear — purge sessions from database
MySQL
To create a new MySQL DB on Dreamhost it is best to use the Dreamhost panel.
To create a database locally: mysqladmin -u root -p create <dbname>_development
mysql -u yourdblogin -p -hyourdbdomain.yourdomain.com yourdb
To load a table into a database:
mysql -u [username] -p[password] -hmysql.[domainname].com [database_name] < iso_country_list.sql
drop table sessions; — delete the sessions table
show tables; — show all tables for database
describe sessions; — show the sessions table
check table sessions; — check the sessions table for corruption and/or nonexistence
Gem Sources
Make sure to add GitHub: gem sources -a http://gems.github.com