Ã
Älphä Blüë
Hi all,
I have a quick interpolation question..
def calculate_tsos(model, datavar)
var = model.findall)
var.each do |rows|
puts "#{model} (Team = #{rows.team.name} | #{datavar} =
#{rows.datavar}"
end
end
The only thing that doesn't work is the datavar within interpolation in
the puts statement. How do I make it so that my datavar value is passed
to datavar in the puts statement so that it would be similar to:
datavar = ydspgm
rows.datavar should be equal to rows.ydspgm but it's not. I'll get an
undefined method datavar. I'm not sure how I can pass the name of that
variable to that interpolation piece of code.
thanks.
I have a quick interpolation question..
def calculate_tsos(model, datavar)
var = model.findall)
var.each do |rows|
puts "#{model} (Team = #{rows.team.name} | #{datavar} =
#{rows.datavar}"
end
end
The only thing that doesn't work is the datavar within interpolation in
the puts statement. How do I make it so that my datavar value is passed
to datavar in the puts statement so that it would be similar to:
datavar = ydspgm
rows.datavar should be equal to rows.ydspgm but it's not. I'll get an
undefined method datavar. I'm not sure how I can pass the name of that
variable to that interpolation piece of code.
thanks.