Jason Galvin
Jason Galvin

Reputation: 1323

options_for_select in HAML

The options_for_select form helper in Rails builds a drop-down list collection with a pre-selected value like this:

<%= options_for_select([['Lisbon', 1], ['Madrid', 2], ...], 2) %>

What's the equivalent in HAML?

Upvotes: 1

Views: 1788

Answers (1)

numbers1311407
numbers1311407

Reputation: 34072

lose the enclosing <% %> and just leave the =?

<%= whatever %>

becomes

= whatever

Just note the indentation is correct, of course.

Upvotes: 4

Related Questions