Skip to content

Instantly share code, notes, and snippets.

@JonasNielsen
Created April 1, 2010 20:17
Show Gist options
  • Save JonasNielsen/352318 to your computer and use it in GitHub Desktop.
Save JonasNielsen/352318 to your computer and use it in GitHub Desktop.
- if client.is_company?
- hide = ""
- else
- hide = "hidden"
#company_information{:class => "#{hide}"}
%div
%br/
= f.label :company_name
%br/
= f.text_field :company_name
%br/
= f.label :org_no, 'Organisation Number'
%br/
= f.text_field :org_no
@chriseppstein
Copy link

This is better:

#company_information{:class => ("hidden" if client.is_company?)}

Haml automatically drops attributes set to nil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment