Text_field


#1

Hi, All.

Is it possible to use the text_field with an instance variable.

Controller:
def hoge
@value = ‘result’
end

View:
<%= text_field ‘value’ %>

It don’t work.
Please help.


#2

<%= text_field ‘value’, ‘to_s’ %>
Is it strange?
Any idea?


#3

Junichi Goza wrote:

Is it possible to use the text_field with an instance variable.

Controller:
def hoge
@value = ‘result’
end

View:
<%= text_field ‘value’ %>

You can’t use text_field as that only works with objects. There is a
text_field_tag helper method that should do the job though:

<%= text_field_tag ‘value’, @value %>


Philip R.
http://tzinfo.rubyforge.org/ – DST-aware timezone library for Ruby