ruby on rails - How can I call text_field_tag with an array? -
consider this:
text_field_tag :phone, :class => "input span2", :id=>"follow_up_phone"
however, if have arguments in array: [:phone, {class: "input span2", id: "follow_up_phone"}]
how call text_field_tag using array?
text_field_tag array
doesn't seem work
first of all: where's value? signature is:
text_field_tag(name, value = nil, options = {})
so, have call way:
text_field_tag :phone, nil, :class => "input span2", :id=>"follow_up_phone" ^
and array
has be:
[:phone, nil, {class: "input span2", id: "follow_up_phone"}]
use splat operator pass array:
text_field_tag *array
Comments
Post a Comment