Ruby on Rails
Friday, January 10, 2014
Hello,
-- I have an array :-
a = [1, 2, 3, 4, 5]
I have 13 objects with sequence. I want to assign a's value to these objects which will be repeated.
so after every 5 objects, these a's value will be assigned & will be repeated.
a.each.with_index do |col, col_index|
Some code here.
// How should I again assign the col_index to '0' again, so that I can repeat those values & save values to the objects?
end
I am able to assign first 5 objects.
Thanks,
Avinash
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/912e4d43-ed17-4d74-97e4-71b4401bca51%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment