Markaby Rules
May 6th, 2006
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.
May 25th, 2006 at 10:13 AM i completely agree, this is good stuff.