undefined方法`stringify_keys!' for“test”:String meta_search在一个操作中进行多次搜索

时间:2013-04-26 00:29:59

标签: ruby-on-rails search meta-search multiple-models

我正在尝试使用meta_search在同一控制器中的多个模型上运行搜索。使用我当前的代码,如果我输入数据库的东西,它可以工作,但当我尝试应用程序时,我得到以下错误

 NoMethodError in HomeController#index

undefined method `stringify_keys!' for "test":String

app/controllers/home_controller.rb:6:in `index'

Parameters: 
{"utf8"=>"✓",
 "authenticity_token"=>"MFFR9GHZWSPBBFugTSvr7ZMJlxpWwGZqeNH3/SzPQ8k=",
 "q"=>"",
 "apps_name"=>"test",
 "commit"=>"Search"}

home_controller.rb

    class HomeController < ApplicationController
        def index
           @search = Database.search(params[:q])
           @databases = @search

           @search2 = Application.search(params[:apps_name])
           @application_s = @search2 
       end

       def about
       end    
  end

index.html.erb

<%= form_tag("/home/index", :method => "get") do %>
  <%= label_tag(:q, "Database:") %>
  <%= text_field_tag(:q) %>
  <%= submit_tag("Search") %>
<% end %>

<%= form_tag("/home/index", :method => "get") do %>
  <%= label_tag(:app_name, "Application:") %>
  <%= text_field_tag(:app_name) %>
  <%= submit_tag("Search") %>
<% end %>

0 个答案:

没有答案
相关问题