union join

def join_both_message
    inner_query = Message\
          .merge(join_voice_message)\
          .joins("UNION SELECT messages.* FROM messages")\
          .merge(join_text_message)


    Message.unscoped.select("*").from(inner_query, :messages)
  end