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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dcd590295f2a350045dce2f322b9fc4f?d=identicon&s=25 Unni Krishnan (unnikrishnanes)
on 2007-07-10 07:41
Create Project


>  rails project_name


change directory to 'project_name'

project_name> ruby script/server


create 3 Databases

databasename_development
databasename_test
databasename_production


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
end
---------------------------

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.