diff --git a/app/models/poll.rb b/app/models/poll.rb index cf6f0f452ad7b69f42be3586dcd534cd1f6e0df3..da9180a6f5c241a320efd2c7f251a436f1b38365 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -5,12 +5,13 @@ class Poll < ActiveRecord::Base belongs_to :status_message has_many :poll_answers, -> { order 'id ASC' } has_many :poll_participations + has_one :author, through: :status_message xml_attr :question xml_attr :poll_answers, :as => [PollAnswer] #forward some requests to status message, because a poll is just attached to a status message and is not sharable itself - delegate :author, :author_id, :diaspora_handle, :public?, :subscribers, to: :status_message + delegate :author_id, :diaspora_handle, :public?, :subscribers, to: :status_message validate :enough_poll_answers validates :question, presence: true