1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Avoid unnecessary conditional block

GeneratedAttribute#column_name checks already for reference? on the
attribute returning the right name to use as symbol for label and field.
This commit is contained in:
Giovanni Cappellotto 2014-05-01 17:21:16 +02:00
parent ca20037899
commit bed8882372

View file

@ -21,13 +21,8 @@
<%%= f.label :password_confirmation %><br>
<%%= f.password_field :password_confirmation %>
<% else -%>
<%- if attribute.reference? -%>
<%%= f.label :<%= attribute.column_name %> %><br>
<%%= f.<%= attribute.field_type %> :<%= attribute.column_name %> %>
<%- else -%>
<%%= f.label :<%= attribute.name %> %><br>
<%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
<%- end -%>
<% end -%>
</div>
<% end -%>