# \[ANN\] HAML 0.2: The Bomb

**URL:** <https://www.ruby-forum.com/t/ann-haml-0-2-the-bomb/72725>\
**Category:** Rails\
**Created:** [October 18, 2006, 3:17pm UTC](https://www.ruby-forum.com/t/ann-haml-0-2-the-bomb/72725 "2006-10-18T15:17:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 18, 2006, 3:17pm UTC](https://www.ruby-forum.com/t/ann-haml-0-2-the-bomb/72725/1 "2006-10-18T15:17:56Z")

</div>

—FIRST—

I want to thank everyone for the tremendous response to HAML. I’m  
absolutely amazed at the sheer number of sites that have switched over  
to HAML. I am honestly shocked at the emails I get. This started as a  
passion of mine and has grown into the passion of others. Special  
thanks for this release goes to Nathan Wiesenbaum who gives new meaning  
to prolific.

—THE DEAL—

After nearly a 90% code-base rewrite, we find our selves with a  
new-and-improved HAML… codenamed The Bomb. And its features are ready  
to _drop_!

We have many, many new features available including…

- Multi-class Handling
- Multi-single-lines with the - character.
- Blocks via Silent Scripting
- Proper Error Reporting

Read all about the new features at:

[http://hamptoncatlin.com/2006/haml-0-2-the-bomb](http://hamptoncatlin.com/2006/haml-0-2-the-bomb)

Or, just update your code off the haml trunk:

svn://hamptoncatlin.com/haml/trunk

The README file is far more complete now and is almost a tutorial. So,  
give that a read-through to find new features.

-hampton.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 18, 2006, 6:27pm UTC](https://www.ruby-forum.com/t/ann-haml-0-2-the-bomb/72725/2 "2006-10-18T18:27:42Z")

</div>

Exciting! I read the tantalizing apetizers on your blog and trac  
site. Can’t wait for the main course to be served. Will the trac  
tutorial be expanded soon?

How does HAML handle if-else-then constructs? I use them to  
selectively show menu options, for example.

\<% if current\_user.has\_permission?(‘admin’) %\>  
\<%= link\_to “admin menu”, :controller =\> “admin”, :action =\> “menu” %\>  
\<% else %\>  
\<%= link\_to “normal menu”, :controller =\> “welcome”, :action =\> “menu”  
%\>  
\<% end %\>  
-Larry

On 10/18/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> —THE DEAL—
> 
> - Proper Error Reporting  
> give that a read-through to find new features.
> 
> -hampton.
> 
> >

–  
Best Regards,  
-Larry  
“Work, work, work…there is no satisfactory alternative.”  
— E.Taft Benson

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 18, 2006, 10:19pm UTC](https://www.ruby-forum.com/t/ann-haml-0-2-the-bomb/72725/3 "2006-10-18T22:19:13Z")

</div>

Ok, thanks (or blames to) silent-scripting, you can convert this to…

- if current\_user.has\_permission?(‘admin’)  
= link\_to “admin menu”, :controller =\> “admin”, :action =\> “menu”
- else  
= link\_to “normal menu”, :controller =\> “welcome”, :action =\> “menu”

But, my personal style-preference is doing this with menus.

File: \_admin.haml  
.admin.menu  
= link\_to “admin menu”, :controller =\> “admin”, :action =\> “menu”

File: \_guest.haml  
.guest.menu  
= link\_to “normal menu”, :controller =\> “welcome”, :action =\> “menu”

Then, do…

= render :partial =\> (current\_user.has\_permission?(‘admin’) ? ‘admin’ :  
‘guest’)

Keeps it a little more D.R.Y. … and obviously you usually have more  
than a link-difference in a menu.

Though, that’s a personal style-choice.

-hampton.  
Then, back in your o

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 28, 2006, 9:05pm UTC](https://www.ruby-forum.com/t/ann-haml-0-2-the-bomb/72725/4 "2006-10-28T21:05:51Z")

</div>

Actually, we recently created a google-group called “haml”… so that’s  
the best place.

What kind of select tag do you mean? There are rails helpers for the  
basic kinds, unless you have some specific need.

-hampton.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 27, 2006, 6:52pm UTC](https://www.ruby-forum.com/t/ann-haml-0-2-the-bomb/72725/5 "2006-10-27T18:52:03Z")

</div>

Thanks for the reply. And add a little bit more to my understanding,  
how would a dropselect tag be written in HAML? Assuming:  
lookup model = Service ( with id, and name)  
Current model = Company[service\_id]

Also, what is the best way to contact you about HAML, is there a  
mailing list, or is posting to the RubyRails list the best place?

Thanks for your help.  
-Larry

On 10/18/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> = render :partial =\> (current\_user.has\_permission?(‘admin’) ? ‘admin’ :  
> On Oct 18, 12:15 pm, “Larry K.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > \<%= link\_to “normal menu”, :controller =\> “welcome”, :action =\> “menu” %\>
> > 
> > > new-and-improved HAML… codenamed The Bomb. And its features are ready
> > 
> > Best Regards,  
> > -Larry  
> > “Work, work, work…there is no satisfactory alternative.”  
> > — E.Taft Benson
> 
> >

–  
Best Regards,  
-Larry  
“Work, work, work…there is no satisfactory alternative.”  
— E.Taft Benson

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 29, 2006, 1:44pm UTC](https://www.ruby-forum.com/t/ann-haml-0-2-the-bomb/72725/6 "2006-10-29T13:44:46Z")

</div>

There is a file in the Haml trunk called “REFERENCE”. Its also one of  
the documents on the Haml google-group.

%table  
%tr  
%td= label\_for :model, :attribute  
%td= select :model, :attribute, @droplist

That’d be the Haml for that.

-hampton.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 28, 2006, 9:17pm UTC](https://www.ruby-forum.com/t/ann-haml-0-2-the-bomb/72725/7 "2006-10-28T21:17:52Z")

</div>

Nothing special. This is what I had in mind.

| \<%= label\_for 'model', 'attribute' %\> | \<%= select 'model', 'attribute', @droplist %\> |
|
| |

Is there a tutorial, and/or a reference for the HAML DSL someplace. I  
didn’t see anything an the plugin.  
-Larry

On 10/28/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> >

–  
Best Regards,  
-Larry  
“Work, work, work…there is no satisfactory alternative.”  
— E.Taft Benson

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 7, 2006, 10:47am UTC](https://www.ruby-forum.com/t/ann-haml-0-2-the-bomb/72725/8 "2006-11-07T10:47:37Z")

</div>

Thanks for the sample and the reference. My somewhat jaded mind is  
having a hard time accepting that HAML might just possibly be as easy  
as it looks. These code samples help a lot.  
-Larry

On 10/29/06, Hampton [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> That’d be the Haml for that.
> 
> > \> -- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson
> > 
> > >
> 
> >

–  
Best Regards,  
-Larry  
“Work, work, work…there is no satisfactory alternative.”  
— E.Taft Benson
