I initialize array
k = Array.new
then something like
@m = Modul.where(:rfp_id => @rfp.id)
i = 0
for ii in @m
k = ii.name.to_s
i = i + 1
end
and then
k.each do |a|
...
end
but value is not stored in "k" how can i do this?
Change this k = ii.name.to_s to k.push(ii.name.to_s). It will work. You did not anywhere add the item ii.name.to_s to your array k. k = ii.name.to_s means in each loop iteration, you are going to reference a new string object to the local variable k. Read Array#push to get introduce yourself to the method.
Don't need to write k = Array.new, ratherk = [] is enough for your purpose.