Skip to Content
Ruby on Rails For Dummies®
book

Ruby on Rails For Dummies®

by Barry Burd
January 2007
Beginner
330 pages
6h 52m
English
Wiley
Content preview from Ruby on Rails For Dummies®

Chapter 8. Action‐Packed Adventures

In This Chapter

  • Watching the controller interact with the view

  • Passing information between the controller and the view

  • Dividing a task into several different files

The material back in Chapter 3 involves a lot of magic. When you click a Finish button, Rails creates 35 folders and 45 files. Later in the process, Rails creates Web forms and updates databases. And to get all this functionality, you write only five lines of code.

So what's the trick? What does Rails do behind your back to make all this wizardry happen?

This chapter reveals one part of the magic; namely, the interaction between a controller and its view.

Model/View/Controller

Imagine that you chair a committee whose members are writing a big report. How do you divide the work? There are good ways and bad ways to assign tasks.

As committee chair, you can decide to do all the work yourself. This saves you the headache of having to delegate tasks. Committee members don't have to contact one another to coordinate their work and check the consistency of their contributions. In the end, no one has to paste parts of the report together. But writing the entire report might overwhelm you. You might have trouble keeping all the facts in your head while you juggle sections 6, 7, 10, and 20 in the huge volume of material.

Another approach is to divide the report into words. The committee has three members, so have each member write every third word. This is definitely a bad idea. If the Gettysburg address ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Ruby on Rails: Up and Running

Ruby on Rails: Up and Running

Bruce Tate, Curt Hibbs
Ruby on Rails® Bible

Ruby on Rails® Bible

Timothy Fisher
Learning Rails 5

Learning Rails 5

J. Mark Locklear, Eric J Gruber, Barnabas Bulpett

Publisher Resources

ISBN: 9780470081204Purchase book