Illusory Follies Sed quis debuget ipsos debugatores?

11Jan/081

Happiness is Ruby on Rails

Ruby on Rails is such a beautiful thing... Here's some view (presentation) code that I slapped together in about 2 minutes:

  <% Category.find(:all).each { |category| %>
    <div id=<%= category.cssid %>>
      <h2><%= category.Name %></h2>
      <ul>
        <% category.items.find(:all).each { |item| %>
        <li><%= item.ShortDescription %></li>
      <% } %>
      </ul>
    </div>
  <% } %>

Basically, it let's me easily list out categories and then items within those categories on a webpage (with per-category styling supported). It's interleaved with HTML and produces very slick output. It just feel so natural and that's what I love about it.

Share and Enjoy:
  • Digg
  • Sphinn
  • Mixx
  • Google Bookmarks
  • Fark
  • Furl
  • StumbleUpon
Comments (1) Trackbacks (0)
  1. It’s a good thing. To do this in Java it seems you need JSP or some kind of additional templating engine. No need with Ruby.


Leave a comment


No trackbacks yet.