Conditional :value in text_field?

Have you tried this?

<p>   <label for="person_languages">Languages</label>     <%= if @person.languages.empty?           text_field 'person', 'languages', {:value => "English" }         else           text_field 'person', 'languages'         end %> </p>

Hope that helps, Matt Buck

Or, [and I think I remember this working for me]

Languages <% val = @person.languages.empty? ? nil : "English" -%>

<%= text_field "person", "languages", {:value => val} %>

I’m pretty sure the nil value doesn’t get added to the options for the text_field. It doesn’t [if I recall correctly] on a link_to. And it’s a lot more DRY.

RSL