Sunday, December 30, 2007

Simply Rich Authenticator using Rails 2.0.2

This is a mini Rails App that uses RESTful authentication and Acts as State Machine to implement: 1. Signup 2. Activation 3. Forgot Password 4. Reset Password 5. Change Password Download it here. Code is available under Rails MIT license. You can check out the code from: svn checkout *http*://simply-rich-authenticator.googlecode.com/svn/trunk/simply-rich-authenticator-read-only Happy New Year! P.S: I have fixed the file size problem. So enjoy the screencast.

Saturday, December 29, 2007

Friday, December 28, 2007

How to develop plugins in Rails - Part 4

In this episode we will revisit the include and extend and learn how it is used when
developing Rails plugins. Download it now : How to develop plugins in Rails - Part 4

Sunday, December 23, 2007

Alias in Ruby

Learn about alias method in Ruby

Upgrading RubyGems to 1.0.1

If the sudo gem update --system hangs then try:

sudo gem install rubygems-update
sudo update_rubygems

This successfully installed Rubygems 1.0.1 on my Powerbook G4. Old version was 0.9.1

Tuesday, December 18, 2007

Time Management for Software Engineers

Today I read the book 4 hour workweek by Timothy Ferriss. While I am not totally convinced by his business ideas, I definitely learned a lot about time management. Check it out in your local library or book store.

Monday, December 17, 2007

Upgrading to Rails 2.0.2

If you are getting the following error during upgrade of Rails:

ERROR: While executing gem ...(OpenURI::HTTPError)
404 Not Found

1. sudo gem update --system.
This will upgrade the Ruby gems to 0.9.5

2. sudo gem install rails --source http://gems.rubyonrails.org
Note that gem install -y is the default, so you don't have to provide it.

Class_Eval in Ruby

Here is the screencast download link for learning about class_eval in Ruby.

Sunday, December 16, 2007

How to install Rails 2.0.1 in Cent OS

gem install rails -y --source http://gems.rubyonrails.org --no-rdoc --no-ri

No documentation will be installed on the production, saves disk space. source option is used if you have difficulties installing.

Friday, December 14, 2007

Thursday, December 13, 2007

Data Migration using ActiveRecord

If you are using ActiveRecord to create new records while you are migrating from a old database, use new instead of create when you want to use the same primary key. Because create does not allow you change the primary key.

Friday, December 07, 2007

Migrations chapter in AWD


The book shows an example of how to use data only migrations. The problem with this approach is that you have to write code for every table you want to populate. A better way to do it is to use the Rick Olsen's rake task found in the Beast source code.

This allows you to add data to any number of tables using just one task. It basically loads the data using fixtures. The fixture files are created under bootstrap folder in fixtures directory.

I still don't get it when the book has an example of irreversible migration and just raises the exception. What if I just want to continue migrating downwards without stopping at the irreversible migration?