I have Sportists
with multiple disciplines and each discipline has one record
. I'd like to display the record and in db they are saved as m100rec
, m200rec
and so on. Is there a way I could display them like so:
@discipline + "rec"
? I have saved @discipline
in my Controller
as an instance variable that contains the session
value and that session has the discipline name saved in it.
EDIT
The view as it goes:
<% @sportists.each do |s| %>
<%= s.m100rec %>
<% end %>
and since there are many disciplines which are all named by the same convention of 'discipline' + 'rec' I would like to make the code more readable and DRY and use just <%= s.discipline+'rec' %>
somehow.