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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -