Beginning Ruby on Rails

Beginning Ruby on Rails

by Steve Holzner

Paperback

$39.99

Product Details

ISBN-13: 9780470069158
Publisher: Wiley
Publication date: 11/29/2006
Series: Wrox Beginning Guides
Pages: 408
Product dimensions: 7.42(w) x 9.20(h) x 0.92(d)

About the Author

Steven Holzner is the award-winning author of more than 100 programming books. He’s been involved in Ruby on Rails for a long time, and does commercial Rails development. He’s also been on the faculty of Cornell University and MIT, as well as having been a contributing editor for PC Magazine.

Read an Excerpt

Click to read or download

Table of Contents

Acknowledgments.

Introduction.

Chapter 1: Welcome to Ruby.

Creating a First Web Application.

Getting Started with Ruby.

Checking the Ruby Documentation.

Working with Numbers in Ruby.

Working with Strings in Ruby.

Storing Data in Variables.

Creating Constants.

Interpolating Variables in Double-Quoted Strings.

Reading Text on the Command Line.

Creating Symbols in Ruby.

Working with Operators.

Handling Operator Precedence.

Working with Arrays.

Using Two Array Indices.

Working with Hashes.

Working with Ranges.

Chapter 2: Conditionals, Loops, Methods, and Blocks.

It’s All about Making Choices: the if Statement.

Using the case Statement.

Using Loops.

Creating and Calling a Method.

Making Use of Scope.

Working with Blocks.

Chapter 3: Classes and Objects.

All about Encapsulation.

Creating a Class.

Creating an Object.

Basing One Class on Another.

Understanding Ruby’s Object Access.

Overriding Methods.

Creating Class Variables.

Creating Class Methods.

Creating Modules.

Creating Mixins.

Chapter 4: Welcome to Rails.

Putting Ruby on Rails.

Introducing Model-View-Controller Architecture.

Giving the View Something to Do.

Mixing Ruby Code and HTML Inside the View.

Passing Data from an Action to a View.

Escaping Sensitive Text.

Adding a Second Action.

Chapter 5: Building Simple Rails Applications.

Accessing Data the User Provides.

Using Rails Shortcuts for HTML Controls.

Working with Models.

Tying Controls to Models.

Initializing Data in Controls.

Storing Data in Sessions.

Chapter 6: Connecting to Databases.

Tutorial on Databases.

Creating a Data-Aware Rails Application.

Creating the Database.

Running the store Application.

Adding Another Record.

Beautifying the Display.

Chapter 7: Working with Databases.

Displaying Items to the Customer.

Creating a Shopping Cart.

Combining Purchases in the Cart.

Clearing the Cart.

Letting the User View the Cart Anytime.

Chapter 8: Validating and Testing.

Validating the Presence of Data.

Validating if Data Is Numeric.

Validating if Data Is Unique.

Creating the Validator Application.

Writing Your Own Validate Method.

Testing Your Model.

Testing Your Controller.

Chapter 9: Controlling the Action with the Action Controller.

Routing Refinements.

Creating Cookies.

Creating a Filter.

Logging in with Filters.

Using After Filters.

Rendering Text Directly.

Caching.

Chapter 10: Getting the Big Picture with Views.

Creating XML.

Creating XML Attributes.

Using View Helpers.

Using View Pagination.

Using Partial Templates.

Passing Data to Partial Templates.

Chapter 11: Ajax and Rails.

Using Ajax.

Getting Access to Ajax Data.

Using XML and Ajax.

Using HTML Controls and Ajax.

Performing Ajax Searches.

Performing Visual Effects.

Appendix A: Answers to Exercises.

Index.

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews

Beginning Ruby on Rails 3.7 out of 5 based on 0 ratings. 3 reviews.
Guest More than 1 year ago
I've been a big fan and advocate of Dr. Steven Holzner's technical writing ever since penned wrote what, in my humble opinion, is THE authoritative JavaScript reference, New Riders' 'Inside JavaScript'. So it was with great enthusiasm (perhaps unfairly so) that I purchased 'Beginning Ruby on Rails' by Wrox. I expected a lot out of it, which goes against my journalism disciplines of approaching each review objectively and without bias. First, the positives. The good doctor's redeeming quality as a technical author is his ability to make the complex graspable for an audience ¿ being neither too intimidating for the beginning coder, nor too condescending for the experienced architect. In this light, the book is very well done. Also, many readers with whom I've interacted find the holy grail of Rails writing, 'Agile Development with Rails' to be too presumptuous and at times difficult to grok. Holzner addresses this crowd very appropriately, so those new to Rails, or Ruby programming, or web development in general will appreciate this book. I realize that writing an introductory level book on any web framework is a huge undertaking for any platform. An author has to introduce a programming language, object-oriented tenets, database theory, SQL, operating systems support, web server integration, page handling, etc. ¿ and then get into the actual web development. Add to this the challenge of a framework like Rails evolving at such a pace that a major publication might be outdated by the time it hits the shelves, and you've got a pretty daunting task at hand. Holzner gives a good introduction into the Rails directory structure, working with databases, command-line syntax for creating Rails apps, working with Rails scaffolding, and provides a very healthy discussion for using Ajax in Rails. There's practical code in the book you can yank and use right away (not dependent on previous chapters), and the book shows how to work with WEBrick. There's a nice little section on unit testing, and cited are examples for setting up Rails on a Windows PC, a Mac, or a Linux box, so the content is available to a wide audience. But with that said, I found the book to be short in a couple of key areas. Only a scant amount of information was provided on working with XML and for using ActionController for REST-like URL mapping. And there isn't anything at all presented on the use of RJS templates. And there's likewise a tragic omission of using Rails to author web services, and nothing was presented about apps based on real-world relationships from database tables, only a simple one-to-many example. I also found the book to be incomplete without a firm discussion of a page's life cycle when handled by Rails. And there shockingly wasn't enough mentioned about the critical facet of Rails ¿ its underlying Model-View-Controller architecture. And what winds up being the book's most code-heavy example ¿ a Rails shopping cart using session data and custom models - is merely regurgitation of the Pragmatic Programmers sample in the 'Agile...' book. The book's appendix is merely the answers to the end-of-chapter questions. I would have liked to see such a section dedicated towards more in-depth info on keeping Rails up to date, working with and authoring custom Ruby gems, examples of various sites currently using Rails, URLs to screencasts and podcasts, and IDEs developers can use instead of hand-coding new applications each and every time out. Since the examples mainly create a new rails app for each demo, I worry that the book may allow the first-time reader to misconstrue Rails development as a lot of work for even the simplest of jobs. Which defeats the whole purpose of Rails to begin with. So, I'm giving this book 3 stars. It's very well written with a friendly voice and it'll get you into Rails fast. It's a great way to start learning RoR development for any level of developer. I've shared it with a few fri
Anonymous More than 1 year ago
Anonymous More than 1 year ago