-
Website
http://jonathansng.com -
Original page
http://www.jonathansng.com/ruby-on-rails/ruby-on-rails-tutorial-now-with-more-202/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
Search Engine Optimization
1 comment · 1 points
-
Nik Bauman
1 comment · 1 points
-
zackmctee
1 comment · 1 points
-
srinathbtech
2 comments · 1 points
-
Quad Core Imac
1 comment · 1 points
-
-
Popular Threads
finally a tutorial which uses rails 2 AND is suitable for beginners like me. I tried to start with rails, but there are no tutorials that take advantage of the newest version.
Can't wait until you post the next entry!!
Bye
[1.] rails bookstore -d mysql
script/generate scaffold Book title:string description:text
[2.] rake db:create:all
rake db:migrate
thanks for the posting & good luck with your new ventures.
I have the command to generate a Rails app for use with a MySQL database, maybe I will make it bold so it's clearer.
As for, rake db:create:all, I've never used it...EVER :P Thanks for posting, perhaps somebody else will have that problem.
wrong constant name Title:stringController
What I ran was:
script/generate scaffold Book title:string description:text
from within the bookstore directory. Removing all and repeating the above still gave the same result. This is the ruby environment:
Ruby version 1.8.6 (x86_64-linux)
RubyGems version 0.9.4
Rails version 1.2.4
Active Record version 1.15.4
Action Pack version 1.13.4
Action Web Service version 1.2.4
Action Mailer version 1.3.4
Active Support version 1.4.3
Edge Rails revision unknown
Application root /home/steve/projects/ruby/bookstore
Environment development
Database adapter mysql
Try visiting the link to the ONLAMP article I have posted, or updating to Rails 2.0.
I was pulling my hair out trying to do all the Internet tutorials written for earlier versions.
.... I hope the books I ordered are up to date.
Keep up the good work!
I had to do a
"rake db:create"
to get the mysql to work (should have set up before).
Oh, and the last image link is missing "wp-content" in the target url.
Good luck !
Great tutorial. Definitely one of the more understandable ones I have read.
However, one thing I would like to see is the "what next" part. Its great that we can see how to get started, but I'm sooo keen to see how you would move it forwards (adding additional functionality), e.g. letting people register and add books.
If anybody happens to know of a tutorial that sounds like what I'm after - please, please, please point me in the right direction : )
Thanks for a good tutorial which is relevant for 2.0. I was using the Rails book but had to stop at page 77. because the examples need 1.2.x.
guess i can go back to the book to complete the depot app.
st
I just checked out meeta.com. Nice site! How did you do the routing? The routes look very clean.
Thanks,
Cheri
Thanks.
db:migrate will migrate through all of your migrations, so no, you don't need to run it each time, unless of course you need those fields generated in the database immediately.
Thanks
newayz here it comes again..
Nice tutorial Jonathan..Thank you very much for you efforts..
With javascript on, there is a popup that asks you if you want to delete the book, and that does work. Although the code is inline and quite horrendous.
I guess this can all be changed behind the scenes, but it stuff like that is so important - why didn't they do it right?
The destroy link has a JS confirmation prompt, which you can disable in the view.
It's nothing to fault the framework for, the destroy link you see was the result of a scaffold generation, which allows you get get your application up and running.
If for some reason, you need to run an application that supports non-JS users, of course you will need to make those changes.
Like I've stated before, scaffolding is meant to assist with development...not replace it. How many skyscrapers or houses do you see, post-production, with scaffolding?
Thanks
Thanks again!
I had to make a couple of changes because I was using postgresql. I had to go into the config/database.yml and change the adapter to postgresql and the database to bookstore_dev. These were in the development section. Then I had to rake db:create and then I was able to do the 'script/generate scaffold Book...'
thanks!
Thanks
I get the error mentioned by steve, although I did update everything I could imagine:
macbook-air:bookstore totto$ script/generate scaffold Book title:string description:text
wrong constant name Title:stringController
macbook-air:bookstore totto$ rails -v
Rails 2.0.2
Any hints would be appreciated...
Thank you for the great tutorial!
very important point is using of upstream version of rails.
keep it up-to-date.. people need it ..
I wish I'd knows about RoR earlier. You can create database interfaces in two minutes with RoR while I'd spent hours creating similar things with PHP. Amazing!
I'm running OSX leopard and was trying to use MySQL.
Some trouble I hand with the tutorial and I had to figure out myself:
Socket file in config/database.yml needed to be changed (for Leopard). Had to change add line of code:
socket: /var/mysql/mysql.sock
under "development", "test" and "production"
I also had to insert password in the given fields.
Database 'bookstore_development' had to be manually created in mysql
rails bookstore -d mysql
With the original script I got a Rails project named -r :)
finally a tutorial which uses rails 2 AND is suitable for beginners like me. I tried to start with rails, but there are no tutorials that take advantage of the newest version.
Can’t wait until you post the next entry!!
Bye"
i cannot emphasize with this anymore than has already been said. you explain everything clearly, you know exactly what you are talking about, and explain all the minute details.
you're a great instructor and i look forward to reading more of your tutorials.
I've been trying to get somewhere with ruby on rails tutorials form various sources and have been pulling my hair out. and feeling very stupid. yours is the first i got to work.
so far anyways...
woop woop.
h
rake aborted!
#42000Unknown database ‘bookstore_development’
I've been stuck at this step for hours. :(
I'm totally new to this.
ROR 2.0.2 creates a default database reference name for you called 'bookstore_development' in you config/database.yml file.
If no db exits, then the migration will fail.
Just open MySQL (via Query Browser) and create a database called 'bookstore_development' and rerun the rake db:migrate command.
Thank you so much :D!
MySQL runs on port 3306 by default, so you connection thru the Query browser should be something like hostname: localhost, port: 3306.
The only account created after installing MySQL is "root" and with no password, I believe.
"root" is the admin account, so you will have all access
hope this helps
Great pace!
Keep 'em coming
There must be a more efficient way of doing this. Any suggestions?