Ildar
Ildar

Reputation: 343

How to make a textarea with some text with HAML

I have this code in my HAML file with rails.

= find_and_preserve f.text_area :notes

It outputs

<textarea id="asdf_notes" name="asdf[notes]"></textarea>

How can I make this:

<textarea id="asdf_notes" name="asdf[notes]">SOME PLAIN TEXT</textarea>

?

It should be easy, but I spent about an hour and found nothing...

Upvotes: 0

Views: 1594

Answers (1)

Tobias Cohen
Tobias Cohen

Reputation: 19999

The textarea should take its contents from the model object linked with the form.

For example, if your form is:

= form_for @customer do |f|

You'd set @customer.notes = "SOME PLAIN TEXT" where appropriate in your controller.

Upvotes: 2

Related Questions