From e2fa2ecf0d97167f4dabb286fbb72cc4ac33499e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 14 Dec 2018 14:19:07 +0100 Subject: [PATCH] Avoid outer variable shadowing warning There were two variables named "title", one for the question and one for the answer. --- db/dev_seeds/polls.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/db/dev_seeds/polls.rb b/db/dev_seeds/polls.rb index 26256981d..15e1595d4 100644 --- a/db/dev_seeds/polls.rb +++ b/db/dev_seeds/polls.rb @@ -42,24 +42,24 @@ end section "Creating Poll Questions & Answers" do Poll.find_each do |poll| (1..4).to_a.sample.times do - title = Faker::Lorem.sentence(3).truncate(60) + "?" + question_title = Faker::Lorem.sentence(3).truncate(60) + "?" question = Poll::Question.new(author: User.all.sample, - title: title, + title: question_title, poll: poll) I18n.available_locales.map do |locale| Globalize.with_locale(locale) do - question.title = "#{title} (#{locale})" + question.title = "#{question_title} (#{locale})" end end question.save! - Faker::Lorem.words((2..4).to_a.sample).each do |title| + Faker::Lorem.words((2..4).to_a.sample).each do |answer_title| description = "

#{Faker::Lorem.paragraphs.join("

")}

" answer = Poll::Question::Answer.new(question: question, - title: title.capitalize, + title: answer_title.capitalize, description: description) I18n.available_locales.map do |locale| Globalize.with_locale(locale) do - answer.title = "#{title} (#{locale})" + answer.title = "#{answer_title} (#{locale})" answer.description = "#{description} (#{locale})" end end