I am very new to Ruby on Rails; I just started this week and I'm struggling to try to understand it. I've read the LAMP tutorial along with Amy's, and started reading the Agile Web Developer book.
I am having some problems though. First off, I am very (still) confused about Models, Views, and Controllers. From my understanding, views are what the end user sees. Models do database stuff and Controllers is the space between Views and Models. Basically, it tells the database to import data, check/validate data, etc. Am I on the right path so far?
When creating a Rails app, you run 'ruby script/generate <something>'. The something being either model, controller, or scaffold. How do you know which one to run? Is there one that just creates all three (model, view, and controller)?
I'm sure I'm going to have a bunch more questions later, but I just need a little kick to start going first.
if you create a table in a database, set up config/database.yml with
your DB info, and do
ruby script/generate scaffold [table name]
it will generate your model, controller and several views(for CRUD
functions)
the first time I tried that while learning rails and going through
AWDWR, it blew my mind. =)
I picked up the Agile Development w/ Ruby Rails book and started going
through it. But, I have to agree with you, maybe I should read it
twice...or three times.
I feel like there's a LOT of power using Ruby on Rails and that is why
I really want to learn it. But at the same time, it's hard giving up
PHP because that's what I know.
Looks like I have some reading to do this weekend!!!
Ah, this helps a little too. Thank you very much for taking the time
to write.
I read a lot of the "Pragmatic Programmers - Programming Ruby", second
edition. After getting through most of the book this weekend, and how
I started to read the "Agile Web Development with Rails" book last
week, I'm still a little confused....book-wise.
There's a book on how to learn ruby, which is great. But, like
learning any language, I find that they are all similar, it's just a
matter of learning the syntax.
Now, the problem. It seems like the first book (learning Ruby) is
good, but doesn't talk much about databases. Now the second book
(AWDwR) is good, but jumps into databases too quickly. Too bad there
isn't something in the middle....or is there?
Alright, I started to look at yet, another book, and I think I found
the winner.
The "Ruby on Rails: Up and Running" book from Curt Hibbs and Bruce Tate
seems to be, at least for me, the bridge between "Pragmatic Programmers
- Programming Ruby" and AWDwR.
I haven't been through the whole book yet, but just going through some
of the example chapters, I thought was awesome. It explains how to get
your database configured and the relationships created. And best of
all, it all pretty much makes sense.
I think if I go through the book another time or two, it will make a
LOT more sense. If nobody has seen it, definiately pick it up. It
just came out and it's from O'Reilly.
Thanks for the compliment, I’m really glad you are finding the book helpful. If you feel so inclined, it’d be nice if you could post some review comments on Amazon: