Text_field

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.

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs