Markaby Rules

I’ve been playing with Markaby the past few nights. I love it! I’m in the camp that would rather write everything in Ruby rather than mix with html and ERb. I find reading this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
error_messages_for 'laptop'

p do 
  label "Name", :for => "laptop_name"
  text_field 'laptop', 'name'
end

div do
  label "Condition", :for => "laptop_condition"
end
div do 
  collection_select("laptop", "condition_id", @conditions, "id", "description")
end

much easier and enjoyable than this code:

1
2
3
4
5
6
7
8
9
10
<%= error_messages_for 'laptop' %>

<p><label for="laptop_name">Name</label><br/>
<%= text_field 'laptop', 'name'  %></p>

<div><label for="laptop_condition">Condition</label>
<div>
<%=  collection_select("laptop", "condition_id", @conditions, "id", "description") %>
</div>
</div>

The ERb code is much noisier and therefore harder to read. The Markaby code is cleaner and more elegant.

Advertisements

1 Response to “Markaby Rules”


  1. 1 _ugly May 6, 2006 at 7:55 pm

    i completely agree, this is good stuff.


Comments are currently closed.



Pages

Categories

Copyright ©2008-2013 James E Orchard-Hays, All Rights Reserved

%d bloggers like this: