Ruby on rails 在rails 3中创建辅助对象

Ruby on rails 在rails 3中创建辅助对象,ruby-on-rails,helpers,Ruby On Rails,Helpers,我正在尝试将以下被剪切的对象转换为帮助对象: <%= f.autocomplete_field :profissao_nome, autocomplete_profissao_nome_pacientes_path, :value => (@item.profissao.nome if @item.profissao), :id_element => "#paciente_profi

我正在尝试将以下被剪切的对象转换为帮助对象:

<%= f.autocomplete_field :profissao_nome,
                autocomplete_profissao_nome_pacientes_path,
                :value => (@item.profissao.nome if @item.profissao),
                :id_element => "#paciente_profissao_id", :class => 'element text search-modal'%>
            <%= f.text_field :profissao_id, :type => "text" %>
            <%= link_to "", search_profissaos_path, :class=>"iframe", :anchorDescription => "paciente_profissao_nome", :anchorId => "paciente_profissao_id" %>

确保将form builder对象f传递给方法

def lookup_field(object_name, method, source, options ={})

    autocomplete_field(object_name, method, source, options) + "\n" +
    text_field(object_name, "religiao_id", {:type => "text"})  + "\n" +
    link_to("", eval("search_religiaos_path"), :anchorDescription=>object_name.to_s+"_religiao_nome", :anchorId=>object_name.to_s+"_religiao_id", :class => "iframe")  end
  end