Reputation: 48440
I am working on converting some HTML to HAML. I am attempting to output the following in a Ruby on Rails form:
<p>Date: <input type="text" id="datepicker"></p>
What's the best way to convert this to HAML? I tried something like:
=f.input#datepicker{:type => 'text'}
But that doesn't work.
I've also tried the following without much luck:
%p
Date
= f.text_field {:id => 'datepicker'}
Upvotes: 0
Views: 370
Reputation: 106
The =
is for evaluating Ruby code and outputting it to the page, which is why it does not work for you. You're mixing Ruby with HAML conventions.
If you want to use the Ruby form helpers, you should do the following:
%P
Date:
= f.text_field <ATTRIBUTE_NAME>, {:id => 'datepicker'}
Upvotes: 2