How to connect mysql whit Ruby

Hi !

I am a newbie !

I want to use scaffold !

I dont know if I undestand everything right !

  1. create table in mysql (I use mysql query browser)

  2. set config/database.yml


adapter: mysql
database: hms
host: 127.0.0.1
username: root
password:
socket: /var/run/mysqld/mysqld.sock

  1. rails ruby script/generate scaffold link Admin

[email protected]:~/rails/howmanystep$ ruby script/generate scaffold linkP
Admin
exists app/controllers/
exists app/helpers/
exists app/views/admin
exists app/views/layouts/
exists test/functional/
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
identical app/models/link_p.rb
identical test/unit/link_p_test.rb
identical test/fixtures/link_ps.yml
error Before updating scaffolding from new DB schema, try
creating a table for your model (LinkP)

Where is my error ?

Thanks !!!

M.

Marco wrote:

  1. set config/database.yml
  2. rails ruby script/generate scaffold link Admin
    dependency model

Where is my error ?

Thanks !!!

M.

Hi Marco,

You need to create a model and a table for it before you can generate a
scaffold for it. I would recommend that you follow one of the many
online tutorials for Ruby on Rails. Do let us know if you have trouble
finding a good one - I think there’s one called Rollin on Rails on
onLamp.com but I don’t have the link handy - Google should be able to
find it for you.

Cheers
Mohit.

I am still follow the book …

But I doesnt undestand the file /sql/create.sql

This is the model ?

how to create this from phpmysql or from mysql query browser?

Thanks

On Mar 25, 8:32 am, “Marco” [email protected] wrote:

I am still follow the book …

But I doesnt undestand the file /sql/create.sql

Hi, Marco.

If by the book you mean Agile Web Dev, you should get the second
edition or read up on migrations – it’s a much more elegant and
useful way to create your db than using .sql files.

That said, could you post the error messages you get when you try to
import the .sql file and the contents of the file? Perhaps there’s a
typo that new eyes will spot.