0
votes

I've been starting to use simple_form in my rails application, which is quite nice. But I was not able to find a function which allows me to rename a field, without the use of i18n.

I have a radio button in my formular, which allows to choose the delivery type. Controlled by that a few fields need a different naming (but its still the same field with the same information).

(e.g. there's a delivery note which is called weight note or notification depending on the delivery type, but contains the same information).

I checked the readme, the railscast and searched a lot but didn't find a build-in way to do that. One option of course would be to create a special locales file just for that, but that feels a little over the top.

1

1 Answers

0
votes

I found my answer in a different question regarding simple_form. After looking for that part in the readme, I also found it there.

<%= simple_form_for @user do |f| %>
  <%= f.input :username, :label => 'Whatever name you want..' %>
<% end %>

This also overwrites the name given in the i18n file.