I try to pass in a variable in a active record query:
class UsersController < ApplicationController
def show
@user = User.find_by_username(params[:username])
@tags = @user.tag_list
i = 0
@tags.each do |tag|
i= i + 1
@tag"#{i}" = Info.tagged_with(tag.name)
end
end
end
As you can see, I try to pass in a variable in @tag. I tried @tag"#{i}", but this doesn't work. What do I need to type in, to get @tag with the number i? My goal is the following output:
@tag1
@tag2
@tag3
Thanks in advance!