Reputation: 2610
Is it possible for me to dynamically determine a field name or variable, e.g.
module ApplicationHelper
def current_week
1
end
Controller
def @player = Player.find(params[:id])
/item/show.html.erb
<%= @player.total_for_week_{current_week} %>
This way I can update the current_week variable, either manually or based on a formula, and have it flow to all of my views. Is there a way to do this?
Thanks!
Upvotes: 0
Views: 35