I have 3 tables: questions, tokens, email.
When I paste question, some token (rand(9999) for example) inserting,
too. Its great. But i need paste tokens as much as I have emails in my
the database called ‘Email’ (i have about ~10).
I think i should use each.do for email, but how, following code doesnt
@w = Digest::SHA1.hexdigest(rand(99999999).to_s)
@question = Question.new(params[:question]) if success = @question.save emails = Email.find(:all) #this pasrt emails.each do |e| #doesnt work Token.create(:token=>@w,:is_active=>"1") end # :( end end render :json => @question.to_ext_json(:success => success)
How can i fix this?