Forum: Ruby on Rails Commands to set up project ( including model & controller)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Unni K. (Guest)
on 2007-07-10 09:41
Create Project

>  rails project_name

change directory to 'project_name'

project_name> ruby script/server

create 3 Databases


open database.yml in config folder and give the database details. I
think , you only have to give the password.

next, you have to create model

project_name> ruby script/generate model Model_name

edit /db.migrate/001_create_modelnames

add commands for creating table

for ex:-
def self.up
  create_table :classifieds do |t|
    t.column :title, :string
    t.column :price, :float
    t.column :location, :string
    t.column :description, :text
    t.column :email, :string
    t.column :created_at, :timestamp
    t.column :updated_at, :timestamp

then, execute this against database

projet_name> rake migrate

next, creating controller

project_name> ruby script/generate controller Controller_name
This topic is locked and can not be replied to.