you want to create a database in ruby on rails..
You must first know that you dont need to create database anymore. just
create tables and by default the rails will place your table in a
developtment.yml I think.

well this is the code on how to generate a table

you type this in your cmd inside the project directory you've created

cmd> rails generate scaffold table_name field_name:string
field_name2:integer field_name3:float

after it runs type this command

cmd> rake db:migration

then
cmd >rails server

then you have a model for your table table_name with a fields of
field_name1 field_name2 field_name3 id created_at and updated_at

hope this helped..





On Tue, Jan 10, 2012 at 1:39 AM, Robert Walker <[email protected]> wrote:

> amir a. wrote in post #1040065:
> > CREATE DATABASE amiref;
> > USE amiref;
> > CREATE TABLE refoo
> > (
> >   f1 VARCHAR(20) ,
> >   f2 VARCHAR(30) NOT NULL ,
> >   f3 INT ,
> >   PRIMARY KEY(f1)
> > );
> > CREATE TABLE IF NOT EXISTS users
> > (
> >   user_id1 VARCHAR(20) NOT NULL ,
> >   user_id2 VARCHAR(50) ,
> >   password VARCHAR(30) ,
> >   email VARCHAR(50) ,
> >   PRIMARY KEY(user_id1,user_id2)
> > );
> > now I want to create those database and tables in ruby on rail with
> > model. how can I do it? please help me. thanks
>
> First I'll reiterate to read the Rails guide. It explains everything you
> need to know:
>
> http://guides.rubyonrails.org/migrations.html
>
> However, I just wanted to add my strong suggestion that you DO NOT
> recreate these tables as you show them here. They are really poorly
> designed for use with Rails.
>
> You'll learn about the right way to do it by reading the Rails guides.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to