Merge branch 'master' into fix/shift_creation_polls

This commit is contained in:
Bertocq
2017-10-04 15:27:54 +02:00
47 changed files with 304 additions and 446 deletions

View File

@@ -23,7 +23,6 @@ class Poll::Question < ActiveRecord::Base
validates :poll_id, presence: true
validates :title, length: { minimum: 4 }
validates :description, length: { maximum: Poll::Question.description_max_length }
scope :by_poll_id, ->(poll_id) { where(poll_id: poll_id) }
@@ -40,15 +39,10 @@ class Poll::Question < ActiveRecord::Base
def searchable_values
{ title => 'A',
proposal.try(:title) => 'A',
description => 'B',
author.username => 'C',
author_visible_name => 'C' }
end
def description
super.try :html_safe
end
def valid_answers
(super.try(:split, ',').compact || []).map(&:strip)
end
@@ -59,7 +53,6 @@ class Poll::Question < ActiveRecord::Base
self.author_visible_name = proposal.author.name
self.proposal_id = proposal.id
self.title = proposal.title
self.description = proposal.description
self.valid_answers = I18n.t('poll_questions.default_valid_answers')
end
end