Ruby on Rails WashOut GEM SOAP定义事件

时间:2015-08-20 18:16:36

标签: ruby-on-rails ruby soap wash-out

我有这段代码:

soap_action "relatorio",
           :args => {:a => :integer},
               :return => :string,
           :response_tag => "Relatorios"

  def relatorio
  @relato = Relato.where(cliente_id: params[:a]).pluck(:projeto_id)
  @relati = Relato.where(cliente_id: params[:a])
  @reltask = Reltask.where(relato_id: @relati).pluck(:task_id)
  render :soap => :relato => {@relato}, :reltask => {@reltask}
       end

渲染中哪个错误,这就是我需要的,我需要xml响应就好  数据  数据

如何使它正确,我正在尝试不同的方式但我无法理解它。

1 个答案:

答案 0 :(得分:0)

这就是代码应该是什么样子

soap_action "relato",
:args => {:a => :integer},
:return => {
:relato => [{:projeto => :string, :atividade => :string}]
}
def relato
@relato = Relato.where(cliente_id: params[:a]).pluck(:projeto_id)
  @relati = Relato.where(cliente_id: params[:a])
  @reltask = Reltask.where(relato_id: @relati).pluck(:task_id)
render :soap =>
{:relato => [
{:projeto => @relato, :atividade => @reltask }]}
end