Have written some RoR sites in the past, but never bothered too much at DRYing up my views as it's only ever been me looking at the code.
Just starting a new site, that is likely to be a collaboration, and need help
I call this line multiple times in my views, and from multiple places.
<%= Person.find_by_id(rider.person_id).name %>
I'd like to be able to just do
<%= get_name(rider.person_id) %>
So I'd assume I'd put this code somewhere
def get_name=(id)
Person.find_by_id(id).name
end
But where? I've tried in the model and as a helper, but always get nomethoderror.