Skip to content

Commit

Permalink
Adding a slide about controllers.
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschright committed Aug 17, 2011
1 parent 3bd4a4f commit 5f8d24b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rubything.textile
Expand Up @@ -544,6 +544,15 @@ These also work through has_many associations, so given a particular user record
% and a message that says "Congrats, <name>, you're the angriest person here!"
% AE note - this might be a good one for people moving fast, but the way I would probably recommend doing it is involved enough I'd keep this as a bonus exercise only %

h1. What about the C in MVC?

Now that we've seen and edited models and views, let's take a quick look at the controller files in our project.

What does a controller do?
* It connects the view and the model, calling methods on the models to get the data needed for the view.
* It responds to the HTTP request from the browser, and renders the requested type of output (in our scaffolds, this is html or xml, but other things like json can easily be added--instant API!)
* The controller is also where you would add access control, like only allowing the user who wrote the rant to delete it.

h1. Making Your Own

* Exit @microrant@ directory
Expand Down

0 comments on commit 5f8d24b

Please sign in to comment.