From ceebae644fc6543dbf4f2eafc88b3f7c5e1b2983 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 22 Nov 2016 11:41:10 +0100 Subject: [PATCH] removes question column from poll_questions --- app/models/poll/question.rb | 1 - app/views/admin/poll/questions/_form.html.erb | 2 -- config/locales/activerecord.en.yml | 6 ++++++ config/locales/activerecord.es.yml | 3 +-- .../20161122101702_remove_question_from_poll_questions.rb | 5 +++++ db/schema.rb | 3 +-- spec/models/poll/question_spec.rb | 1 - 7 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 db/migrate/20161122101702_remove_question_from_poll_questions.rb diff --git a/app/models/poll/question.rb b/app/models/poll/question.rb index 07acee9d7..2dacddb70 100644 --- a/app/models/poll/question.rb +++ b/app/models/poll/question.rb @@ -40,7 +40,6 @@ class Poll::Question < ActiveRecord::Base self.title = proposal.title self.description = proposal.description self.summary = proposal.summary - self.question = proposal.question self.all_geozones = true self.valid_answers = I18n.t('poll_questions.default_valid_answers') end diff --git a/app/views/admin/poll/questions/_form.html.erb b/app/views/admin/poll/questions/_form.html.erb index 32f16c773..fdd9c72d9 100644 --- a/app/views/admin/poll/questions/_form.html.erb +++ b/app/views/admin/poll/questions/_form.html.erb @@ -9,8 +9,6 @@
<%= f.text_field :title, maxlength: Poll::Question.title_max_length %> - <%= f.text_field :question, maxlength: Poll::Question.question_max_length %> - <%= f.text_field :valid_answers %> <%= f.text_area :summary, rows: 4, maxlength: 200 %> diff --git a/config/locales/activerecord.en.yml b/config/locales/activerecord.en.yml index f34757195..109ee7468 100644 --- a/config/locales/activerecord.en.yml +++ b/config/locales/activerecord.en.yml @@ -69,6 +69,12 @@ en: external_url: "Link to additional documentation" geozone_id: "Scope of operation" title: "Title" + poll/question: + title: "Question" + valid_answers: "Posibles answers" + summary: "Summary" + description: "Description" + external_url: "Link to additional documentation" errors: models: user: diff --git a/config/locales/activerecord.es.yml b/config/locales/activerecord.es.yml index 8ce255739..52b1a0471 100644 --- a/config/locales/activerecord.es.yml +++ b/config/locales/activerecord.es.yml @@ -70,8 +70,7 @@ es: geozone_id: "Ámbito de actuación" title: "Título" poll/question: - title: "Título" - question: "Pregunta" + title: "Pregunta" valid_answers: "Posibles respuestas" summary: "Resumen" description: "Descripción" diff --git a/db/migrate/20161122101702_remove_question_from_poll_questions.rb b/db/migrate/20161122101702_remove_question_from_poll_questions.rb new file mode 100644 index 000000000..2532b2948 --- /dev/null +++ b/db/migrate/20161122101702_remove_question_from_poll_questions.rb @@ -0,0 +1,5 @@ +class RemoveQuestionFromPollQuestions < ActiveRecord::Migration + def change + remove_column :poll_questions, :question + end +end diff --git a/db/schema.rb b/db/schema.rb index 48341e5d1..acd0e5344 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20161107174423) do +ActiveRecord::Schema.define(version: 20161122101702) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -314,7 +314,6 @@ ActiveRecord::Schema.define(version: 20161107174423) do t.integer "author_id" t.string "author_visible_name" t.string "title" - t.string "question" t.string "summary" t.string "valid_answers" t.text "description" diff --git a/spec/models/poll/question_spec.rb b/spec/models/poll/question_spec.rb index 6cb38d023..0738d95af 100644 --- a/spec/models/poll/question_spec.rb +++ b/spec/models/poll/question_spec.rb @@ -20,7 +20,6 @@ RSpec.describe Poll::Question, type: :model do expect(q.author_visible_name).to eq(p.author.name) expect(q.proposal_id).to eq(p.id) expect(q.title).to eq(p.title) - expect(q.question).to eq(p.question) expect(q.all_geozones).to be_true end end