instance method
textarea
Ruby on Rails 8.1.2
Since v8.0.4Available in: v8.0.4 v8.1.2
Signature
textarea(object_name, method, options = {})
Returns a textarea opening and closing tag set tailored for accessing a specified attribute (identified by method) on an object assigned to the template (identified by object). Additional options on the input tag can be passed as a hash with options.
Examples
textarea(:article, :body, cols: 20, rows: 40) # => <textarea cols="20" rows="40" id="article_body" name="article[body]"> # #{@article.body} # </textarea> textarea(:comment, :text, size: "20x30") # => <textarea cols="20" rows="30" id="comment_text" name="comment[text]"> # #{@comment.text} # </textarea> textarea(:application, :notes, cols: 40, rows: 15, class: 'app_input') # => <textarea cols="40" rows="15" id="application_notes" name="application[notes]" class="app_input"> # #{@application.notes} # </textarea> textarea(:entry, :body, size: "20x20", disabled: 'disabled') # => <textarea cols="20" rows="20" id="entry_body" name="entry[body]" disabled="disabled"> # #{@entry.body} # </textarea>
Parameters
-
object_namereq -
methodreq -
optionsopt = {}
Source
# File actionview/lib/action_view/helpers/form_helper.rb, line 1277
def textarea(object_name, method, options = {})
Tags::TextArea.new(object_name, method, self, options).render
end
Defined in actionview/lib/action_view/helpers/form_helper.rb line 1277
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::FormHelper