About this Book

Ruby on Rails is a leading web application framework built on top of the fantastic Ruby programming language. Both the language and the framework place an extreme emphasis on having a principle of least surprise and getting out of the way of the developers using it.

Ruby on Rails has been growing at a rapid pace, with large internet companies such as Yellow Pages and Groupon using it for their core functionality. With the latest release of Rails, version 3.1, comes a set of changes that improve the already brilliant framework that has been constructed over the past seven years. The fantastic community around the framework has also been growing at a similar pace.

This book is designed to take you through developing a full-featured Rails application from step one, showing you exactly how professionals in the real world are developing applications right now.

Who should read this book

This book is primarily for those who are looking to begin working with the Ruby on Rails framework and who have some prior experience with Ruby, although that is not entirely necessary.

Later chapters, such as chapter 13, “Designing an API,” chapter 17, “Engines,” and chapter 18, “Rack-based applications,” delve into more advanced topics, so these chapters are suitable for people who already have a foundation with Rails and are looking to expand their skillset a little further.

If you’re looking for a book that teaches you the same practices that are used in the real world, then this is the book you are looking for.

Roadmap

Chapter 1 introduces the Ruby on Rails framework and begins to show how you can develop the beginnings of an application.

Chapter 2 shows off test-driven development and behavior-driven development, which are two core concepts in this book and for developing Rails applications. By testing the code you write, you can be assured that it’s always working that way.

Chapters 3 and 4 discuss the application you develop in this book—a project-management app of sorts—and delve into the core concepts of a Rails application. They also look at developing the first core features of your application.

Chapter 5 begins an introduction to nested resources, building on top of the features developed in the previous two chapters.

Chapter 6 introduces authentication, requiring users to sign in to the application before they can perform certain tasks.

Chapter 7 builds on the work in chapter 6 by adding new areas of the application that are accessible only to users with a certain flag set in the database. You also use namespaces for the first time.

Chapter 8 builds on the basic authorization created in chapter 7, fleshing it out into something neater and more scalable.

In chapter 9, you learn about file uploading using the Paperclip gem. In this chapter you also learn about testing parts of your application that use JavaScript and about CoffeeScript, a neater language that compiles down to JavaScript.

Chapter 10 builds not one but two new features for the application, adding the ability to comment on a ticket as well as track the ticket’s lifecycle through varying states.

In chapter 11, you add a feature that lets users assign tags to tickets so they can be easily grouped. You also add a feature to allow users to search for tickets matching a certain state or tag, or both.

Chapter 12 begins our foray into dealing with email in a Rails application. You’ll see not only how to send email but also how to receive messages and parse them into meaningful data in your application.

Chapter 13 involves creating an API for the project resources in an application that provide other applications with a standardized way to access your application’s data. We also look at token-based authentication and how to create multiple versions of an API.

In chapter 14, you deploy the application to an Ubuntu box and set it up to act like a normal web server using a RubyGem called Passenger and a web server called nginx.

In chapter 15, you create a “nice to have” feature: the ability to sign up or sign in using either Twitter or GitHub. When this is complete, people are no longer required to provide you with an email and password when they sign up; instead, they can use GitHub and Twitter as authentication providers.

By chapter 16, your application is all grown up and needs to handle any kind of performance issues it encounters. We cover basic performance enhancements, such as pagination, database indexing, and page and fragment caching.

Chapter 17 introduces a new feature for Rails 3: engines. You develop one of your own from scratch—a forum system—and then integrate it with the existing application.

Chapter 18 delves into the depths of Rack, explaining how Rack applications are made and can be tied into Rails. The chapter also explains, and contains examples of, middleware being used in Rails.

Code conventions and downloads

Code conventions in the book follow the style of other Manning books in the In Action series. All code in listings and in text appears in a monospaced font like this to separate it from ordinary text. In some cases, the original source code has been reformatted to fit on the pages. In general, the original code was written with page-width limitations in mind, but sometimes you may find a slight formatting difference between the code in the book and that provided in the source download. In a few rare cases, where long lines could not be reformatted without changing their meaning, the book listings contain line-continuation markers. Code annotations accompany many of the listings, highlighting important concepts. In many cases, numbered bullets link to explanations that follow in the text.

Source code for all the working examples in this book is available for download from the publisher’s website at www.manning.com/Rails3inAction.

Author Online

The purchase of Rails 3 in Action includes free access to a private forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the authors and other users. To access and subscribe to the forum, point your browser to www.manning.com/Rails3inAction, and click the Author Online link. This page provides information on how to get on the forum once you are registered, what kind of help is available, and the rules of conduct in the forum.

Manning’s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the authors can take place. It’s not a commitment to any specific amount of participation on the part of the authors, whose contribution to the book’s forum remains voluntary (and unpaid). We suggest you try asking the authors some challenging questions, lest their interest stray!

The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.22.164