Walt Stoneburner is a software architect with over 20 years of commercial application development and consulting experience. Fringe passions involve quality assurance, configuration management, and security. If cornered, he may actually admit to liking statistics and authoring documentation as well.
He's easily amused by programming language design, collaborative applications, and ASCII art. Self described as a closet geek, Walt also evaluates software products and consumer electronics, draws cartoons, produces photography, writes humor pieces, performs slight of hand, enjoys game design, and can occasionally be found on ham radio.
Walt may be reached directly via email at wls@wwco.com. He publishes a tech and humor blog called the Walt-O-Matic athttp://www.wwco.com/~wls/blog/. Rumors suggest that some of his strange videography may be found on iTunes.
Currently he is employed at Business & Engineering Systems Corporation as a lead engineer developing advanced software solutions for knowledge management.
Other book reviews and contributions include AntiPatterns and Patterns in Software Configuration Management (ISBN 0-471-32929-0, p. xi) and Exploiting Software:
How to Break Code (ISBN 0-201-78695-8, p. xxxiii).
About the Author
A.P. Rajshekhar, Senior Developer with Vectorform, has worked on enterprise-level web applications and game development. His endeavors include the development of a Learning Management System, Supply Management Solution, and Xbox-based games. He holds a Masters Degree in Computer Applications. He is a regular contributor to the Devshed Portal on topics ranging from server-side development (JEE/.Net/RoR) to mobile (Symbian-based development) and game development (SDL and OpenGL) with a total readership of more than 1.4 million.
____________________________________________________
Authoring a book is not an easy feat. However, the help and guidance from my family and friends helped me to author this book. First, I would like to thank Packt Publication for providing me an opportunity to work on such an exciting project. I would like to thank my parents for their constant encouragement. Special thanks to my friends Shrikant Khare and Sormita Chakraborty for their support and encouragement.
______________________________
Table of Contents
Preface 1
Chapter 1: Getting Started with Ruby and RoR
Ruby and RoR—The Next Level in Dynamic Web Development 5
Ruby 6
Ruby on Rails (RoR) 7
Philosophy 7
Features 8
Installing and Configuring Ruby and RoR 9
Manual Installation 9
Downloading and Installing Ruby 10
Updating Gem 13
Installing RoR 14
One-Click RoR Installation 15
Download and Unzip the Instant Rails 16
Configure Instant Rails Installation 16
Testing the Installation 19
Ruby 19
RoR 19
Summary 24
Chapter 2: Getting to Know Ruby and RoR
Ruby—the Basics 25
Classes, Attributes, Methods, and Objects 26
Classes 26
Attributes 27
Methods 28
Objects 30
Inheritance 31
Modules 32
Data Types 32
Number 33
Float 33
String 33
Blocks and Iterators 34
Blocks 34
Iterators 34
Exception Handling 37
Data Structures 38
Arrays 38
Hashes 38
RoR—Concepts and Components 39
RoR is a Ruby-Based Framework 39
RoR Implements MVC Pattern 40
Active Record 40
Action View 42
Action Controller 43
Hello World—the RoR Way 45
Setting up the Application Structure 45
Adding the First Controller Class 47
Defining the Action Method 48
Adding the View Template 49
Testing the Application 50
Summary 51
Chapter 3: TaleWiki—The Basic Setup
Understanding the Requirements 53
System Requirements 54
Module-Specific Requirements 55
Managing the Stories 55
Designing the Database 56
Understanding the Conventions 57
Designing the E-R Model 58
Defining the Schema 61
Creating the Tables 62
TaleWiki—Developing the Tale Management Module 64
Creating the Application Structure 64
Generating the Scaffolds 65
Customizing the Model 68
Customizing the Controller 73
Refining the View 75
Testing the Application 79
Summary 84
Chapter 4: Managing the Users
Understanding the Requirements 85
Managing the User 86
Managing Roles 87
Designing the Tables 88
Designing the E-R Model 88
Deriving the Schema 92
Creating the Tables 93
Developing the User Management 94
Developing the Role Management 95
Developing the User Management Functionality 98
Testing the Functionalities 104
Summary 109
Chapter 5: Gathering User Comments
Understanding the Requirements 111
Login Management 112
Managing the Comments 112
Designing the Database 113
Designing the E-R Model 113
Deriving the Schema 115
Creating the Tables 116
Developing the Login Management Module 116
Creating the Login Page 117
Implementing the Authenticate method 118
Setting up the Session 120
Applying Authorization 121
Tying Up the Loose Ends 123
Developing the Comment Management Module 124
Generating the Scaffold 125
Modifying the Model 125
Refining the View 127
Customizing the Controller 129
Testing the Module 130
Summary 135
Chapter 6: Setting up the Template
Understanding Migration 137
Generating Migration Classes 138
Editing the Generated Classes 139
Running the Migration 142
Customizing the Template 143
Defining the Layout 143
Customizing the Layout of the Login Page 143
Defining the Master Layout 148
Setting up the Navigation 152
Testing the Application 155
Summary 156
Chapter 7: Tagging the Tales
Understanding the Requirements 157
Developing the Tag management Module 158
Selecting a Plug-in for Tag Management 159
Installing the Plug-in 159
Setting up Tables Required by the Plug-in 161
Developing the Tag Management Module 163
Adding a Tag 163
Visualizing the Tag Cloud 166
Searching By Tag 169
Testing the Modifications 172
Summary 175
Chapter 8: Enhancing User Experience with Ajax
Understanding the Requirements 177
Implementing Ajax 178
What is Ajax? 178
How Ajax and RoR are Related 179
Implementing the Live Search 180
Specify the Location to Display the Result 180
Use the observe_field Helper 181
Modify the Action Method 183
Implementing the In-line Editing 183
Marking the Fields for In-line Editing 184
Set up the Controller 187
Testing the Modifications 188
Summary 190
Chapter 9: Developing the Interface for Administration
Understanding the Requirements 191
Implementing the Functionalities 192
Modification of the Deletion of Tales 192
Providing Access to All the Functionalities of the Comment Management Module 194
Implementing Auto-Complete for the User name 195
Implementing Search 197
Testing the Modifications 199
Summary 204
Chapter 10: Deploying the TaleWiki
Understanding the Production Environment 205
Development Mode 206
Test Mode 206
Production Mode 206
Changing to the Production Environment 207
Migrating to the Production Database 207
Configuring Mongrel 208
Points to Consider 210
Summary 210
Index 211
Preface
Ruby on Rails is an open-source web application framework ideally suited to building business applications, accelerating and simplifying the creation of database-driven websites. It has been developed on the Ruby platform.
This book is a tutorial for creating a complete website with Ruby on Rails (RoR). It will teach you to develop database-backed web applications according to the Model-View-Controller pattern. It will take you on a joy ride right from installation to a complete dynamic website. All the applications discussed in this book will help you add exciting features to your website. This book will show you how to assemble RoR's features and leverage its power to design, develop, and deploy a fully featured website.
● Screenshot ●