Hi Everyone, this is my first post. So I'll try to be as detailed as possible.
Dev Machine: OSX 10.5.2 Ruby: 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0] Rails: 2.0.2 Using MAMP 1.7.1 with the following settings PHP: 5.2.5 MYSQL : 5.0.41 Using CocoaMySQL .7b5 TextMate 1.5.7
I've built several sites using basic HTML, PHP, ASP, ect, but this is my first jump into web2.0 development.
I'm learning ruby on rails and am going through some of the tutorials. Some tutorials work fine, ei. http://railsonedge.blogspot.com/2008/03/tutorial-beginning-ajax-with-rails-20.html
Others don't. They say they are written for rails 2.+ and ruby 1.8.6 but the result I get is nearly universal. Take the example below from http://fairleads.blogspot.com/2007/12/rails-20-and-scaffolding-step-by-step.html
I get to the step after creating the migration file "001_create_movies.rb". I run rake db:migrate, verify with cocoamysql that the tables and fields are created properly. They do so I run ruby script/server.
The server loads up as expected http://localhost:3000. But when I navigate to http://localhost:3000/movies I DO NOT get the expected results. I am missing the description field and one_sheet_url field. I followed the instructions to the letter up to that point. Again, this similar result has happened with other tutorials so I think the error is somewhere on my end.
[b]This is what I should have:[/b] [img]http://bp0.blogger.com/_fnfsff2gWFY/R2PwNTuWBmI/AAAAAAAAAA8/U7wskSum5z0/s1600/movies1.png[/img] [img]http://bp0.blogger.com/_fnfsff2gWFY/R2PwNTuWBnI/AAAAAAAAABE/3fzWebHr_ic/s1600/movies2.png[/img] [img]http://bp1.blogger.com/_fnfsff2gWFY/R2PwNjuWBoI/AAAAAAAAABM/XiEST0Z9cxI/s1600/movies3.png[/img]
I case the pics don't come up above: http://bp0.blogger.com/_fnfsff2gWFY/R2PwNTuWBmI/AAAAAAAAAA8/U7wskSum5z0/s1600/movies1.png http://bp0.blogger.com/_fnfsff2gWFY/R2PwNTuWBnI/AAAAAAAAABE/3fzWebHr_ic/s1600/movies2.png http://bp1.blogger.com/_fnfsff2gWFY/R2PwNjuWBoI/AAAAAAAAABM/XiEST0Z9cxI/s1600/movies3.png
[b]But I get this:[/b] [img]http://i134.photobucket.com/albums/q118/shaiss/Picture3.png[/img] [img]http://i134.photobucket.com/albums/q118/shaiss/Picture4.png[/img] [img]http://i134.photobucket.com/albums/q118/shaiss/Picture5.png[/img]
I case the pics don't come up above: http://i134.photobucket.com/albums/q118/shaiss/Picture3.png http://i134.photobucket.com/albums/q118/shaiss/Picture4.png http://i134.photobucket.com/albums/q118/shaiss/Picture5.png Here is the output from terminal: http://pastie.caboo.se/170436
I've tried the page in safari 3.1 and firefox 3b4. Like I said this only happens with certain tutorials I go through. I'm a noob at this so its frustrating not understanding why this is happening. If anyone can help clear this up for me I would greatly appreciate it. Thank you for your time, Shai
I had a look at the tutorial and it looks like you didn't put all attributes in the command line. The title attribute is right after the model name and the other two attributes should be added to that line, too. Could that be your problem? To check what attributes are in your migration, have a look at 001_create_movies.rb migration file. I'm sure you only find the title attribute plus the timestamps.
You can manually add the missing attributes:
t.text :description t.string :one_sheet_url
Then you need to do:
$ rake db:migrate VERSION=0
$ rake db:migrate
Let me know, if I am completely wrong.
Using Rails 2,
rake db:reset is a better choice than migration to 0 and then migrating up.
Just to clarify because I was unable to view your images as I get a denied error from google... are those fields missing from the DB table? Or are they missing from the view?
I was able to look at your terminal output and your last three images, it doesn't look like you're having an errors per se, just missing fields so if you're missing them in your view then you didn't generate your scaffold correctly, and well, if they're missing from both you still didn't generate it correctly. Out of curiosity, why don't you post your migration file and your form (from the movies view) into a pastie and send us the link.