Topic: Rails 2.0.1 Todo list in five lines

rails todo
cd todo
rake db:create:all
script/generate scaffold Todo title:string body:text done:boolean due:datetime
rake db:migrate

Then start the web server
script/server

Open your browser to http://localhost:3000/todos

Copied from http://robmayhew.com/rails-201-todo-list-tutorial/

Re: Rails 2.0.1 Todo list in five lines

Just to make sure we are on the same page !!!

1.- Since Rails 2.0.X use SQLite3 as the default DB. just for backwards compatibility on step 1 use:
rails todo -d mysql
This will create the database.yml file with the correct settings for MySQL DB. use other databases to your specific needs.

2.- After you change to the todo directory, before you run the rake:dbcreate:all you must review your database.yml to make sure includes the correct user/password to access your database.

As a supe quick start this seems to be perfect. I think will be great idea to add some other tutorials to add some more complexity.

Best Regards din00z.

Re: Rails 2.0.1 Todo list in five lines

dinooz: Umm...Rails 2.0.1 doesn't generate SQLite3 as the default for me, it's still MySQL...

Have you changed something?

Re: Rails 2.0.1 Todo list in five lines

Rails 2.0.2 switched the default to SQLite3.

Re: Rails 2.0.1 Todo list in five lines

Ah. It was nonetheless incorrect to say "Since Rails 2.0.X", but okay. Maybe I'll update to Rails 2.0 (I'm surprised it's here so early. And Ruby 1.9 is coming soon!).

Re: Rails 2.0.1 Todo list in five lines

Thanks for the tip on the DB setting.

Re: Rails 2.0.1 Todo list in five lines

Would be interested in a confirmation, but I think you can leave out step 3 for Rails 2.0.2 ?

For me it told me the 3 database's already existed !

E:\ruby\RailsApps\todo>rake db:create:all
(in E:/ruby/RailsApps/todo)
"db/development.sqlite3 already exists"
"db/production.sqlite3 already exists"
"db/test.sqlite3 already exists"

cheers, Dave

Re: Rails 2.0.1 Todo list in five lines

Thank you so much!!!Just what I needed...

Re: Rails 2.0.1 Todo list in five lines

DaveP wrote:

Would be interested in a confirmation, but I think you can leave out step 3 for Rails 2.0.2 ?

For me it told me the 3 database's already existed !

E:\ruby\RailsApps\todo>rake db:create:all
(in E:/ruby/RailsApps/todo)
"db/development.sqlite3 already exists"
"db/production.sqlite3 already exists"
"db/test.sqlite3 already exists"

cheers, Dave

if it's already existing i think u just need to do the migration after u have scaffolded~
(not confirmed tho)

Re: Rails 2.0.1 Todo list in five lines

Nice tut BTW, thanks.

kX| wrote:
DaveP wrote:

Would be interested in a confirmation, but I think you can leave out step 3 for Rails 2.0.2 ?

For me it told me the 3 database's already existed !

E:\ruby\RailsApps\todo>rake db:create:all
(in E:/ruby/RailsApps/todo)
"db/development.sqlite3 already exists"
"db/production.sqlite3 already exists"
"db/test.sqlite3 already exists"

cheers, Dave

if it's already existing i think u just need to do the migration after u have scaffolded~
(not confirmed tho)

The message '...already exists' seems to be spurious. AKA it aint true. If you run it without 'step 3' it didnt work for me. Maybe the message gets generated as the rusult of some out of place error checking. Dont know. I'm a newb. smile

thanks.

OSX 10.6.2
Rails 3.0 beta
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]

Re: Rails 2.0.1 Todo list in five lines

maldrax wrote:

rails todo
cd todo
rake db:create:all
script/generate scaffold Todo title:string body:text done:boolean due:datetime
rake db:migrate

Then start the web server
script/server

Open your browser to http://localhost:3000/todos

Copied from http://robmayhew.com/rails-201-todo-list-tutorial/

I can't wait to read your other postings.  I hope the posting you are referring to will include how to add more types of before_filters.



sell gold Long Island

Last edited by ricky.martin4545 (2010-11-24 06:51:17)