How do I update a sequential attribute with foobar#{n} with n incrementing?
I want to write basically
User.find(:all).each {|u| u.update_attribute("email","nil#{incrementing_number}")}
How do I make that #{incre开发者_StackOverflowmenting_number}
incremement per updated attribute.
:D
Enumerable#each_with_index
User.find(:all).each_with_index {|u,i| u.update_attribute("email","nil#{i}")}
精彩评论