Conditional :value in text_field?

Languages <%= text_field 'person', 'languages', {:value => "English" } %>

I only want to send the value of “English” if @person.languages.empty?
Rails doesn’t like my attempts so far. Has anyone been able to do this?

Have you tried this?

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

Hope that helps,
Matt Buck

Thanks, Matt. I ended up using this to deal with absent variables in
new users while preserving user attributes in edits:

Languages <%= if @person.languages && [email protected]? text_field 'person', 'languages' else text_field 'person', 'languages', {:value => "English" } end %>