Happiness is Ruby on Rails

Posted by Andrew Flanagan

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
  • Fark
  • Furl
  • StumbleUpon

Andrew Flanagan on January 11th 2008 in Actual Events, Geekiness

One Response to “Happiness is Ruby on Rails”

  1. Bill responded on 06 Feb 2008 at 5:50 pm #

    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.

Trackback URI | Comments RSS

Leave a Reply