fix author join for federation callbacks with Poll

This commit is contained in:
Benjamin Neff 2016-03-27 17:22:42 +02:00
parent 374915b45f
commit 800fa1786c

View file

@ -5,12 +5,13 @@ class Poll < ActiveRecord::Base
belongs_to :status_message belongs_to :status_message
has_many :poll_answers, -> { order 'id ASC' } has_many :poll_answers, -> { order 'id ASC' }
has_many :poll_participations has_many :poll_participations
has_one :author, through: :status_message
xml_attr :question xml_attr :question
xml_attr :poll_answers, :as => [PollAnswer] 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 #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 validate :enough_poll_answers
validates :question, presence: true validates :question, presence: true