Couldn’t seem to find the answer to this question – what is the haml syntax for adding styles or a class styling to elements within a rails form_for?
The code I am dealing with is
.row.form
.threecol
.sevencol
= form_for @article do |a|
%h3= a.label "title"
= a.text_field :title
%h3= a.label "description"
= a.text_area :description
%h3= a.label "body"
= a.text_area :body
%br/
= a.submit "Post Article"
.twocol.last
I am wanting to add a style to the text area description element.
I have tried (where new_desc is the class styling)
= a.text_area.new_desc :description
and
= a.text_area { :style ... } :description
but both failed to compile.
Can anyone help with this (hopefully trivial) problem?
text_area is a method that takes (object, method, and options) (http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-text_area)
When you have it attached to a form object, you withhold the object, so it becomes text_area(method, options={})
or