Ryan O'Donnell
Ryan O'Donnell

Reputation: 481

HAML - what does the "!=" operator do?

I am looking at some seemlingly standard Haml code right now, but just noticed it starts off with a "!=", and 5 minutes of googling has failed to give me the answer for what it does:

#What does the '!=' mean? 
!= cache_content_if_not_prefetched(params) do
  -if product_live?
    =render :partial => 'products/product_tile'
  -else
    =render :partial => 'products/unavailable_product_tile'

Upvotes: 2

Views: 2254

Answers (3)

Michael Durrant
Michael Durrant

Reputation: 96554

Same as using = but doesn't sanitize the HTML

See http://haml.info/docs/yardoc/file.REFERENCE.html#unescaping_html

!= "Look  <up>!"

compiles to

Look <up>!

instead of

Look &ltg;up&gt;

Upvotes: 6

mitchimus
mitchimus

Reputation: 828

Read this HAML Documentation. It will give you all the answers you require. I just searched for HAML tags.

Do a CTRL+F for !=. != basically valuates Ruby code just like the equals would

Upvotes: 0

fmendez
fmendez

Reputation: 7338

That is used for Unescaping html

Upvotes: 2

Related Questions