Tech Book

Modern Language Wars: A Look at PHP, Python and Ruby on Rails

Modern Language Wars: A Look at PHP, Python and Ruby on Rails


Ruby Rocks :)

Today I am going to share my very first experience with RubyOnRails, and to describe my feelings its fabulous.

Lets begin

What you need to know already?

  • You should be familiar with any MVC pattern
  • Should have knowledge of Ruby
  • Should know DB & Web server fundamentals

I guess thats more then enough to begin rails journey.

To start with you need following software installed on your box, 🙂 I ma LILO fan so all below configuration and are Linux based. But based on this understanding one can quickly start writing on any other OS too.

Software Needed

  • ruby 1.8.4
  • rails 1.2.3

Once installation and configuration done

rails test_app

cd test_app

vi config/database.ym

add your db credential

script/generate migration add_formelements

> create db/migrate
> create db/migrate/001_add_formelements.rb

vim db/migrate/001_add_formelements.rb

Add code
class AddUsers < ActiveRecord::Migration
def self.up
create_table “formelements” do |t|
t.column “user”, :string
t.column “email”, :string
t.column “password”, :string
t.column “passordreminder”, :text

def self.down
drop_table “

rake db:migrate

== AddUsers: migrating ========================================================
— create_table(“formelements”)
-> 0.0234s
== AddUsers: migrated (0.0236s) ===============================================

script/generate scaffold Formelement

exists app/controllers/
exists app/helpers/
exists app/views/formelements
create app/views/layouts/
create test/functional/
dependency model
create app/models/
create test/unit/
create test/fixtures/
create app/models/formelement.rb
create test/unit/formelement_test.rb
create test/fixtures/formelement.yml
identical app/views/formelements/_form.rhtml
create app/views/formelements/list.rhtml
create app/views/formelements/show.rhtml
create app/views/formelements/new.rhtml
create app/views/formelements/edit.rhtml
create app/controllers/formelements_controller.rb
create test/functional/formelements_controller_test.rb
create app/helpers/formelements_helper.rb
create app/views/layouts/formelements.rhtml
create public/stylesheets/scaffold.css



That’s all enjoy!

Hope you have grate time doing above exercise.

Check this out