Professional Ruby on Rails

Professional Ruby on Rails

This book will make the Rails methodology more tangible to developers familiar with the Microsoft tools. It will help focus on learning Rails development from the point of view of the beginner-to-intermediate Microsoft developer, taking strides to point out the various similarities between Rails and Windows development patterns, and will reference Microsoft tools the reader may already be familiar with. The book serves as a roadmap for ASP.Net, C#, and VB.Net developers wanting to migrate their applications, skill set, and development processes to the newer, agile programming platform that Rails offers. Developers comfortable with Microsoft technologies will learn how Rails provides simplified design, implementation, language features with an extensible enterprise architecture.

About the Author

Noel Rappin is the Director of Rails Practice at Pathfinder Associates ( www.pathfinderagile.com ), and has nearly a decade of experience with web application programming. Noel has a Ph.D. from the Georgia Institute of Technology, where he studied how to teach object - oriented design concepts. He is the co - author of Jython Essentials and wxPython in Action. You can read more of Noel ’ s writing at both the Pathfinder Agile Ajax blog ( http://blogs.pathf.com/agileajax ) and his own blog
( http://10printhello.blogspot.com ).


Who Should Read This Book

This book is intended for intermediate to advanced Rails programmers. It assumes that you already know Ruby, and have either read one of the many wonderful introductory books on Rails or have otherwise consumed some form of a Rails tutorial. In either case, you don ’ t need me to tell you how to create a basic Rails application.
The focus of this book is on the step that comes after just being able to make Rails work. You ’ ve read the basic book, and now you ’ ve been asked to implement a real, live, web application. Suddenly you have all sorts of questions that weren ’ t covered in the introductory material. How do I manage users and security? Is there an easy way to manage time zones or other internationalization issues? How does Rails expect me to organize a team of programmers and manage source issues? How do I automate common build tasks, and how do I deploy to a production server? What do I need to do to secure my site? How can I extend Rails to take advantage of the many wonderful things being done by the Rails programming community?
If you ’ re interested in learning the answer to any of these questions, then this book is for you.

How This Book Is Structured

Over the course of this book, you ’ ll build a single web application, and the ordering of the chapters is based on the growing needs of that application. However, the book has been structured so that individual chapters are as orthogonal as possible, and unless otherwise noted, you should not need to read the entire book to understand the concepts in a particular chapter.
There are two other things about the book ’ s structure worth noting. Wherever possible, the code samples are presented in a test - first style, with a Rails unit or functional test documenting the expected behavior of the new code as written. The idea is to try and present the case for test - first development without a significant time cost, and also to present you with strategies for testing various kinds of Rails features.The Rails online community is an awesome and wonderful thing, full of enthusiastic developers sharing their knowledge and expertise with the community. Each chapter in this book includes a list of blogs, plugins, and/or other Rails web sites that are related to the topic at hand.

The book is organized into the following sixteen chapters and two appendixes:
Chapter 1, Building Resources — This chapter covers setting up the project and its initial resources using REST.
Chapter 2, Rails Source Control with Subversion — After a project is set up, it should be placed under
source control immediately. Subversion is the Rails source control tool of choice and is the topic of this chapter.
Chapter 3, Adding Users — This chapter covers placing the concept of a user into the application, managing secure logins, performing e - mail authorization, and implementing CAPTCHA.
Chapter 4, Build Tools and Automation — Rake is a very handy tool for automating commonly performed actions. With those actions defined, it ’ s a small step to create an environment where automated tests or metrics can be performed continually, as you learn in this chapter.
Chapter 5, Navigation and Social Networking — This chapter covers the basic elements of web application navigation, menus, tagging, search, and pagination.
Chapter 6, The Care and Feeding of Databases — This chapter discusses the use of other database tools
besides the MySQL default, and adding more complex database relationships to the application. It also explores issues of database security.
Chapter 7, Testing Tools — This chapter introduces you to several different tools to improve your testing, including the use of RCov to measure testing, RSpec to specify behavior more directly, and methods for testing views and helpers.
Chapter 8, Rails - Driven JavaScript — This chapter describes how you can use Ruby and Rails to add Ajax and JavaScript to your application, including using RJS to create more complex JavaScript behavior and testing RJS output.
Chapter 9, Talking to the Web — This chapter shows you how to turn your application into a web services data producer, including how to create RSS feeds. It also describes how ActiveRecords turns a Rails application into a web services data consumer.
Chapter 10, Internationalizing Your Application — The World Wide Web encompasses many time zones and languages. This chapter covers managing time in Rails and using the Globalize plugin for internationalization.
Chapter 11, The Graphic Arts — This chapter describes how to install RMagick and other tools to enable graphics, as well as how to use Gruff and Sparklines to create charts.

Chapter 12, Deploying Your Application — This chapter discusses the current state - of - the - art in deploying Ruby applications using Capistrano to automate deployment tasks. It also covers the use of the Mongrel and other server tools to serve the application.
Chapter 13, Performance — This chapter shows you how to measure performance to find bottlenecks in your Rails application, and what to do when you find them.
Chapter 14, Going Meta — Metaprogramming, or writing code that writes or modifies code, is a nifty trick that Ruby handles deftly, and which is used to support some of the most dynamic features in Rails. Adding metaprogramming to an application can reduce duplicated code dramatically, as you learn in this chapter.
Chapter 15, Extending Rails with Plugins — This chapter gives you even more information on using Rails plugins, including how to create, test, and deploy a Rails plugin and use generators.
Chapter 16, Replacing Ruby Tools — This chapter covers using ERB replacements to define output and using JRuby to deploy your application in a Java Web Application server.
Appendix A, Things You Should Download — This appendix explains everything you should download to work with Ruby on Rails, including Ruby, Gems, Rails, and Subversion.
Appendix B, Web Frameworks Inspired by Rails — This appendix briefly describes web frameworks that have been influenced by Rails.