I'm learning Ruby on Rails for a new project of mine. I am referring the book 'Agile Web Development with Rails' which shows how to build a shopping cart and they use scaffolding.
I'm pretty familiar with MVC architecture and have used several frameworks in PHP to build applications. I've never used scaffolding and I'm not sure if that's the best way to start building an application.
Experienced users, please suggest if I should be using scaffolding or should I code manually.
Go ahead and use scaffolding. Scaffolding is just a way to get some working code quickly. It's not a commitment. Often the hardest part with a new technology is getting the first thing working. RoR scaffolding gets you over that hurdle, and then you can replace or extend the scaffold code bit by bit.
As you are a beginner you should use it. Because you may not all the syntax in that case scaffolding can help you out. I generally use it. Because it saves lot of time as it generate good amount of code and in most case error free. So I will suggest you to use scaffolding in RoR. And the generated is easy to understand so can update it as your need.
Why to do it manually when it can be done automatically which saves time?
Use it while learning, but understand what it does so you don't rely on it. In many cases using the scaffold will help you get the app up and running quickly (and you can always modify it later and take out the parts you don't need), but make sure that you know how to do it by hand if you need to fix things with the scaffold or if you need to later do something that doesn't require the scaffold.
In short: Scaffolding is a tool, not a crutch, and should be treated like a tool in your arsenal.
There's good and bad ways to do scaffolding. I strongly discourage anyone using the default rails scaffolds—the HTML it produces isn't particularly good, and its static.
What I do recommend is the use of something like formtastic to do your scaffolds. You can start with something as simple as
<%= semantic_form_for @model do |form| %>
<%= form.inputs %>
<%= form.buttons %>
<% end %>
and get something that's at least as functional as the default scaffolds, and a heck of a lot smarter. you can easily grow into an actual application with it just by replacing the form.inputs with a more defined set of fields you want to appear.