Beginning Rails 3

( 4 )

Overview

Beginning Rails 3 is the practical starting point for anyone wanting to learn how to build dynamic web applications using theRails framework for Ruby. You'll learn how all of the components of Rails fit together and how you can leverage them to create sophisticated web applications with less code and more joy.

This book is particularly well suited to those with little or no experience with web application development, or who have some experience but are new to Rails. Beginning ...

See more details below
Paperback
$27.98
BN.com price
(Save 30%)$39.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (21) from $1.99   
  • New (10) from $2.49   
  • Used (11) from $1.99   
Beginning Rails 3

Available on NOOK devices and apps  
  • NOOK Devices
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK Study
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$17.99
BN.com price
(Save 43%)$31.99 List Price

Overview

Beginning Rails 3 is the practical starting point for anyone wanting to learn how to build dynamic web applications using theRails framework for Ruby. You'll learn how all of the components of Rails fit together and how you can leverage them to create sophisticated web applications with less code and more joy.

This book is particularly well suited to those with little or no experience with web application development, or who have some experience but are new to Rails. Beginning Rails 3 assumes basic familiarity with web terms and technologies, but doesn't require you to be an expert. Rather than delving into the arcane details of Rails, the focus is on the aspects of the framework that will become your pick, shovel, and axe. Part history lesson, part introduction to object-oriented programming, and part dissertation on open source software, this title doesn't just explain how to do something in Rails, it explains why.

  • Learn to create Rails web applications from scratch
  • Includes a gentle introduction to the Ruby programming language
  • Completely updated to include the features of Rails 3

What you’ll learn

Rails 3 includes the combined power of Rails and Merb. Beginning Rails 3 will get you started in learning this technology and creating dynamic web applications in next to no time.

  • Install Rails on a Mac, Windows, or Linux system
  • Understand the Model-View-Controller architecture
  • Learn the value of databases and how to set up MySQL in Rails
  • Get instant feedback on your work by testing in the Rails Console
  • Add Ajax and visual effects to create rich user interfaces
  • Use and create your own Rails plug-ins

Who this book is for

Web developers who want to harness the power of Rails 3 to quickly build dynamic rich Internet applications. Anyone who hasn't used Rails before will be able to learn the basics from this book.

Table of Contents

  1. Introducing the Rails Framework
  2. Getting Started
  3. Getting Something Running
  4. Working with a Database: Active Record
  5. Advanced Active Record: Enhancing Your Models
  6. Action Pack: Working with the View and the Controller
  7. Advanced Action Pack
  8. Improving Interaction with Ajax
  9. Sending and Receiving E-Mail
  10. Testing Your Application
  11. Internationalization
  12. Extending Rails with Plug-ins
  13. Deploying Your Rails Applications
  14. Ruby, a Programmer’s Best Friend
  15. Databases 101
  16. The Rails Community
  17. Git
Read More Show Less

Product Details

  • ISBN-13: 9781430224334
  • Publisher: Apress
  • Publication date: 9/1/2010
  • Edition number: 1
  • Pages: 400
  • Sales rank: 1,470,237
  • Product dimensions: 7.76 (w) x 11.28 (h) x 0.85 (d)

Meet the Author

Rida Al Barazi is a passionate web developer experienced in building smart web applications for startups. He has been designing and building for the web since 2002. He started working with Rails in 2005 and spoke at different web and Rails conferences in Europe and the Middle East.

Rida was raised in Kuwait, grew up in Syria, started his career in Dubai and currently lives in Toronto. In his free time he enjoys music, concerts, movies, traveling and meeting new people. Rida's contact information can be found on his website, www.rida.me.

Cloves Carneiro Jr. is a software engineer and web application developer with over 12 years of experience creating web applications for companies in many fields, including startups, and telecommunication and financial companies. He has been using Ruby on Rails since its early days, being a full-time Rails developer for 4 years. He currently works for Unspace Interactive in Toronto. Born in Brazil and having lived in many parts of the world, he now lives in Toronto with his wife, Jane. He also maintains a personal web site at www.ccjr.name.

Read More Show Less

Table of Contents

About the Authors

About the Technical Reviewer

Acknowledgments

Introduction

Chapter 1 Introducing the Rails Framework 1

The Rise and Rise of the Web Application 1

The Web Isn't Perfect 2

The Good Web Framework 2

Enter Rails 3

Rails is Ruby 4

Rails Encourages Agility 5

Rails is Opinionated Software 7

Rails is Open Source 7

The MVC Pattern 8

The MVC Cycle 8

The Layers of MVC 9

The Libraries That Make Up Rails 11

Rails is Modular 12

Rails is no Silver Bullet 12

Summary 12

Chapter 2 Getting Started 13

An Overview of Rails Installation 13

Installing on Mac OS X 10.6 Snow Leopard 14

Installing the Apple Developer Tools (Xcode) 14

Updating RubyGems and Installing Rails 15

Installing on Windows 16

Installing Ruby 16

Installing Rails 17

Installing SQLite 18

Installing on Linux 19

Installing Ruby 19

Updating RubyGems 20

Installing Rails 20

Installing SQLite 21

Creating Your First Rails Application 21

Starting the Built-In Web Server 22

Generating a Controller 25

Creating an Action 26

Creating a Template 26

Summary 29

Chapter 3 Getting Something Running 31

An Overview of the Project 31

Creating the Blog Application 31

Creating the Project Databases 34

Creating the Article Model 36

Creating a Database Table 38

Generating a Controller 41

Up and Running with Scaffolding 42

Adding More Fields 44

Adding Validations 46

Generated Files 48

Summary 50

Chapter 4 Working with a Database: Active Record 51

Introducing Active Record: Object-Relational Mapping on Rails 52

What About SQL? 53

Active Record Conventions 54

Introducing the Console 54

Active Record Basics: CRUD 57

Creating New Records 58

Reading (Finding) Records 61

Updating Records 66

Deleting Records 67

When Good Models Go Bad 69

Summary 71

Chapter 5 Advanced Active Record: Enhancing Your Models 73

Adding Methods 73

Using Associations 76

Declaring Associations 77

Creating One-to-One Associations 78

Creating One-to-Many Associations 83

Applying Association Options 89

Creating Many-to-Many Associations 90

Creating Rich Many-to-Many Associations 94

Advanced Finding 97

Using the where Method 97

Using a SQL Fragment 97

Using an Array Condition Syntax 98

Using Association Proxies 100

Other Finder Methods 100

Default Scope 102

Named Scope 103

Applying Validations 105

Using Built-in Validations 105

Building Custom Validation Methods 109

Making Callbacks 111

Observers 113

Updating the User Model 115

Reviewing the Updated Models 119

Summary 120

Chapter 6 Action Pack: Working with the View and the Controller 121

Action Pack Components 121

Action Controller 122

Action View 124

Embedded Ruby 125

Helpers 126

Routing 126

RESTful Resources 127

The Action Pack Request Cycle 128

A Controller Walk-Through 129

Setting Up Routes 129

Revisiting the Scaffold Generator 132

Rendering Responses 137

Redirecting 137

Understanding Templates 138

Working with Layouts 139

Looking at the Article Form 141

Using Form Helpers 144

Processing Request Parameters 148

Revisiting the Controller 149

Displaying Error Messages in Templates 150

Edit and Update actions 151

Revisiting the views 152

Staying DRY with Partials 153

Summary 155

Chapter 7 Advanced Action Pack 157

Generating a Controller 157

Nested Resources 161

Sessions and the Login/Logout Logic 167

Lying in State 168

The Shared-Nothing Architecture 168

Storing Sessions in the Database 169

Using the Session 170

Session as a Resource 170

Logging in a User 172

Logging Out a User 173

Improving Controllers and Templates 175

Cleaning Up the Articles Index Page 175

Adding Categories to the Article Form 176

Using Controller Filters 179

Requiring Authentication with Filters 180

Applying Filters to Controllers 181

Adding Finishing Touches 184

Using Action View Helpers 184

Escaping HTML in Templates 185

Formatting the Body Field 187

Adding Edit Controls 187

Making Sure Articles Have Owners 189

Adding Custom Helpers 191

Giving it Some Style 193

Summary 199

Chapter 8 Improving Interction with Ajax 201

Ajax and Rails 201

Prototype and jQuery 202

jQuery and DOM 203

Moving to Practice 204

Not All Users Comment 204

Using Ajax for Forms 208

Deleting Records with Ajax 211

Summary 213

Chapter 9 Sending and Receiving E-Mail 215

Setting Up Action Mailer 215

Configuring Mail Server Settings 215

Configuring Application Settings 218

Sending E-Mail 218

Handling Basic E-Mail 220

Sending HTML E-Mail 226

Adding Attachments 228

Letting Authors Know About Comments 229

Receiving E-Mail 230

Using a Rails Process 231

Reading E-Mail Using POP or IMAP 231

Summary 232

Chapter 10 Testing Your Application 233

How Rails Handles Testing 233

Unit Testing Your Rails Application 235

Testing the Article Model 236

Testing Validations 242

Functional Testing Your Controllers 244

Testing the Articles Controller 244

Creating a Test Helper 245

Running the Full Test Suite 257

Integration Testing 259

Integration-Testing the Blog Application 259

Story-Based Testing 263

Running the Full Test Suite 267

Summary 268

Chapter 11 Internationalization 269

Internationalization Logic in Rails 269

Setting Up i18n in the Blog Application 272

Localizing the Blog Application to Brazilian Portuguese 277

Bilingual Blog 280

Summary 284

Chapter 12 Extending Rails with Plug-ins 285

Finding and Installing Plug-ins 285

Finding Plug-ins 287

Installing Plug-ins 287

Using a Plug-in in Your Application 288

Modifying the Database 289

Modifying the Application to Use the Plug-in 290

Creating Your Own Plug-in 294

Creating the Plug-in Module 296

Making the Plug-in Available to Applications 297

Using SimpleSearch 297

Testing the Plug-in 298

Updating the Controller and Views 300

Summary 306

Chapter 13 Deploying Your Rails Applications 307

Deploying with Capistrano 307

Capistrano Installation 308

Capistrano Recipes 310

Capistrano on the Deployment Server 312

Custom Capistrano Tasks 313

Setting Up Your Server Architecture 313

Modular Architecture 313

Becoming an Instant Deployment Expert 314

Summary 315

Appendix A Ruby, a Programmer's Best Friend 317

Instant Interaction 317

Ruby Data Types 318

Strings 318

Numbers 319

Symbols 320

Arrays and Hashes 320

Language Basics 321

Variables 322

Operators 323

Blocks and Iterators 323

Control Structures 325

Methods 326

Classes and Objects 327

Objects 327

Classes 328

Ruby Documentation 330

Appendix B Databases 101 333

Examining a Database Table 333

Working with Tables 334

Selecting Data 335

Inserting Data 336

Updating Data 337

Deleting Data 337

Understanding Relationships 338

SQL and Active Record 340

Appendix C The Rails Community 341

Beginning Rails 3 Channels 341

Rails Mailing Lists 341

Rails IRC Channel 342

Rails Blogs and Podcasts 342

Rails Guides 343

Rails Wiki 343

Rails APls 343

Rails Source and Issue Tracking 343

Working with Rails Directory 344

Appendix D Git 345

What is Source Control Management? 345

How Does it Work? 345

Git 346

Installing Git 346

Setting Global Parameters 347

Initializing a Repository 348

Ignoring Files 350

Adding and Committing 350

Branching and Merging 352

Remote Repositories and Cloning 357

Learning More 358

Other SCM Systems 359

Online Resources 360

Index 361

Read More Show Less

Customer Reviews

Average Rating 2.5
( 4 )
Rating Distribution

5 Star

(1)

4 Star

(0)

3 Star

(1)

2 Star

(0)

1 Star

(2)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 4 Customer Reviews
  • Posted October 16, 2010

    Great resource for rails newbies, but with one glaring omission

    Every Rails books needs to set the stage, to "explain the rules" so to speak, since using Rails is quite different from other "traditional" approaches of web development (LAMP, etc.). Beginning Rails 3 sets the stage nicely, and continues to deliver throughout the entire text - at least, until it comes to getting your Rails app on the web. The first three chapters follow the typical pattern of a Rails book, explaining the origins of Rails, why it's good, how to install it, and then setting up a very simple web app so the reader can see how easy it is to get Rails up and running. One thing I liked in particular was in Chapter 1, where the authors stressed the importance of being open to the "Rails way" of doing things. This was a nice touch, as there's a good chance the "Rails way" is different from what the reader is expecting, especially if they have some experience developing with PHP. From there the authors continue to get more in-depth on the various aspects of Rails, focusing on Active Record (the database aspect of a web app) and Active Pack (the "bridge" between the user interface and the database) for the first half of the book. Readers who prefer the programming aspect of development will most likely enjoy these chapters. Web designers more interested in the user interface aspects of a web app will enjoy Chapter 8, which goes over Rails' Ajax support. I would have preferred this chapter to be a bit more in-depth, but I like the fact that the authors covered how to switch from the built-in Prototype library to jQuery, which is more common and better suited (in my opinion) for Rails development. Chapter 9, "Sending and Receiving E-Mail" was a welcome surprise. In previous Rails books I've read (Simply Rails 2.0 and Foundation Rails 2) I don't remember this being mentioned - but it's such a common requirement for web apps, that almost every Rails developer needs to learn how to do this as some point. Rails has a very systematic way of testing, and Ch. 10 was a good (though hardly exciting) overview of how to test the various aspects of the web app you've been building (if you've been following along and typing in code as you've been reading - you can also download the code rather than type it all out, if you prefer, and links are provided at the beginning of each chapter). I was also a bit surprised that Internationalization was covered in this book, and this was a really nice touch. It's a very rare Rails developer that doesn't, at some point, want to add some sort of plugin to extend the functionality of the web app they're building. Chapter 12 goes over how to do this, even covering how to create and add your own plugin to Rails. Probably my biggest expectation for this book was Chapter 13, which goes over deploying a Rails app to the web. Unfortunately, this chapter is lacking, mentioning Capistrano and Phusion Passenger in passing, but nothing about server configuration. I personally wanted to know how to do this, even if I decide not to do so with a real web app. This is a serious omission, in my opinion, and mars an otherwise great book. Beginning Rails 3 is a great resource for those who are new the Rails, covering most of the key aspects of Rails 3 web development. Unfortunately, it falls short when it comes to actually explaining how to get your Rails app out into the world.

    1 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Posted October 5, 2010

    A great balance of learning and experience

    Beginning Rails 3 is a book that does a great job introducing an aspiring web developer to the world of Ruby on Rails, and the architecture conventions that Rails utilizes. The book is a good size, goes over the 'hows' and 'whys' of the basics, while creating a useful example project. I work as a Web Designer that is starting to branch into development, and I had some experience with earlier versions of Rails in a couple work environments, but never really caught on to the concept. This book helped clear quite a few things up. Previous "beginner" books I had read didn't explain fully enough, didn't flow well, or were written as what seemed like edited versions of more advanced books. The authors of Beginning Rails 3 do an excellent job of explaining each step. There is a good balance of code entry and explanation, and does not stray from the current topics. The instruction comes across at a decent personal level-as if the authors are there sitting at a table with you over a cup of coffee. Each chapter was also easy to retain in memory. There are also a couple of nice appendices, which give primers for Databases and the Ruby language itself. The project is a blog, which is quite relevant, and can be utilized once completed. Many Rails books in the past have dealt with projects or examples that are hard to build on once learned, such as a store (without anything to sell), or small examples that can't be built upon. I found the project itself to be a key benefit of this book, and plan on deploying for my own blog once I make a few modifications. I really enjoyed this book. Lately, it seems like beginner's books are a bit too dumbed down, or are written in an almost juvenile matter. This book was different, and had a very professional approach with true real-world exercises. I recommend this book for anyone who has some knowledge of the field, but needs a firm foundation for getting to the next step.

    1 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted November 26, 2010

    No text was provided for this review.

  • Anonymous

    Posted October 27, 2010

    No text was provided for this review.

Sort by: Showing all of 4 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)