Ruby on Rails banner

Day 2: Finishing the (Sample) Blog

The rest of this series can be found here.

Made it the rest of the way through the introductory tutorial today.

MVC (model-view-controller) is a neat concept once you get your head around it—the separation of logic vs. data is much stronger than most hand-coded HTML/PHP or WP templates achieve.

Turns out I didn’t need that link to the article from the index page, as it was part of the documentation only one step later…but I often get “good ideas” and jump a few steps ahead without even knowing it.


Partials

  • Will come in very handy, especially on larger projects
  • Resource-oriented style: a new concept; sure makes development easier. I wonder if there are situations where it gets you in trouble though…need more research.

Second model: comments

  • Again, I’m impressed how easy it is to add a major chunk of an app.
  • Refactoring: I didn’t expect the render method to iterate as it does—I expected it to still need to be inside the <% @article.comments.each do |comment| %> loop.

Authentication

  • A “log out” function would be nice, but HTTP basic auth is pretty limited in what it can do.

Other notes

  • “Article” is one of those weird words that if you look at long enough, you start to wonder if it’s really spelled correctly
  • I’m itching to put in a bit of CSS to improve the table listing layout and the textarea size, but am holding back since this won’t become a public project and learning RoR is more important than this demo project  looks.
  • Note to future self: private and protected methods go last in the controller file.

Final code for the day again is on GitHub.

What’s next? Haven’t completely decided yet…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.