Thursday, February 15, 2007
Database Migrations for Agile Web Development
The key here is that database migrations in Ruby on Rails make very easy to go back and forth between more or less functionality in the system you are building. I really hope that PHP would have some similar easy way that supports migrations. That way going truly agile with PHP would be possible as is the case with Ruby on Rail.
Thursday, December 28, 2006
RadRails Tutorial
RadRails Demo Video
Tuesday, December 26, 2006
Integrating RadRails into InstantRails
Hearing about how convinient RadRails is, I thought of downloading the Ruby on Rails stack one by one by myself and installing it, first Ruby, then rails and finally downloading and installing MySQL then configuring them all and running them. But that sounded like a headache, after all InstantRails was doing all this for me in a single step.
I then, by accident, came across this clear and simple description of how to configure RadRails to work with InstantRails! Mission accomplished.
Installing ActiveRBAC
- Start InstantRails.
- Open a Ruby console window.
- cd your_app_name.
- ruby script/plugin discover.
- Reply by no to all questions, except the two questions for http://svn.rails-engines.org/ and https://activerbac.turingstudio.com/.
- ruby script/plugin install engines.
- ruby script/plugin install active_rbac.
Congrats, you're done!
Monday, December 25, 2006
RadRails - IDE for Ruby on Rails
Sunday, December 24, 2006
User Authenticaiton in Ruby on Rails
Saturday, December 23, 2006
Ruby on Rails Forum
Friday, December 22, 2006
Ruby Developers in Egypt?
Thursday, December 21, 2006
Steps in Creating a Rails Application
- Use the rails command to generate a skeleton for your web application.
- Create a database and its tables using MySQL. Make sure to follow Rails conventions in naming tables and table columns.
- Use the scaffold generator to automatically create each model and its controller and views.
- Manually code relationships between tables into model files.
You can now go ahead and view your web application in the browser after starting the web server.
You can start shaping up your web application from here. Go back to the controllers and views, make needed modifications then go back and view your application in the browser. Keep modifying the application files till your web application is complete and is shaped like what you have in mind.
The above sequence is merely a proposed sequence. It is specially suitable for new comers to Ruby on Rails. Sure there are alternative paths. For instance, one can start by creating an empty database, and use Ruby on Rails migrations to create the tables. One can also go about writing controllers and views by hand without first using the scaffolding features of Rails.
If you would like to use migrations rather than creating the database tables directly with MySQL, then you can follow this alternative approach:
- Command line prompt, rails_apps folder: rails appname
- MySQL command line console: create database appname_development;
- Generate a migration after going to the appname folder: ruby script/generate migration add_tables
- Edit 001_add_tables.rb file to define database tables.
- rake migrate
- For each model (~table): ruby script/generate ModelName
- Define relationships between database tables inside model files (appname/app/models/ModelName)
- ruby script/server
- Open your browser at: http://127.0.0.1:3000/ModelName+'s'
Wednesday, December 20, 2006
Migrations in Ruby on Rails
With the introduction of migrations in Ruby on Rails, now all you have to do is create an empty database without even creating any tables in it. Then you go into Rails and write migrations. Those migrations take care of creating the database tables for you. The really interesting and useful thing about migrations is that you can expand your database by adding more tables or more columns to existing tables in an incremental way. The application would still run smoothly. Most importantly, you can role back to previous states of the database also using migrations. For instance let's say that after you had a database containing a table with 4 columns you made a migration to add a 5th column to that table. You can easily role back to the previous state of the database when it had only 4 columns by using migrations in Ruby on Rails. With complex database structures that have many tables and many columns built in an incremental way, the migration feature of Rails makes it very convenient to go back and forth between different stages of the database without worrying about spoiling it.
Monday, November 27, 2006
Rails and Clean URLs
The W3C web site uses clean URLs in all its web pages. One interesting article in the W3C about clean URLs talks about this. The article though comes under the name Cool URIs.