Laim Bee wrote:
I am new to ROR. I have been reading "Begininng Ruby on Rails" by Steven
Holznewr and "Ruby on Rails for Dummies" by Barry Burd.
Be careful of learning Rails from books. The Rails framework changes
pretty fast, and book publishers can't always keep up.
I have been
going through this a lot slower than I would like, because many of the
examples don't work and I've been trying to glean information from both
books to get them working.
Why not try the Rails Guides website instead, or in addition? It's
excellent and up to date.
My current problem is this:
Following Chapter 9 in "Ruby on Rails for Dummies" we are trying to
build a website for Photos. This website will interface with a mysql
database. I have built out the database, created a model, created a
database table, wrote some code in the migration code to create a column
for filename and description, and created a scaffold.
When I launch the server and view my website for extension photos/new
(creating a new photo in the database), I just see a button titled
"Create". The book shows a screenshot of two text fields being created,
one for filename and one for description.
You say you wrote the migration; did you remember to run it? Check the
database and make sure that it has the fields you expect. If so,
regenerate the scaffold.
Better yet, just forget that scaffolding exists and find a tutorial that
doesn't rely on it.
I'm assuming that I have to
add code to the scaffold to show these forms, is this true?
No. The idea of the scaffold is that it generates a quick-and-dirty set
of views and controller actions based on your database fields. It
sounds like when you generated the scaffold, the generator script didn't
see any fields in your DB table, so it didn't put any fields in the
I am currently using
Rad Rails 1.5.0.025739
Please don't start learning Rails by using an IDE. The framework is not
well suited to conventional IDEs, and does not really benefit from their
use. Try a full-featured editor instead (I like KomodoEdit and jEdit;
many Rails developers use TextMate).
and I believe Rails 2.2
Why start off on an old version of Rails? 2.3.2 is current. Use it