Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 安装contrib软件包后pg_search dmetaphone不工作_Ruby On Rails_Rubygems_Pg Search - Fatal编程技术网

Ruby on rails 安装contrib软件包后pg_search dmetaphone不工作

Ruby on rails 安装contrib软件包后pg_search dmetaphone不工作,ruby-on-rails,rubygems,pg-search,Ruby On Rails,Rubygems,Pg Search,安装pq_搜索并运行contrib包迁移后: class InstallSomeContribPackages < ActiveRecord::Migration def up execute 'CREATE EXTENSION pg_trgm;' execute 'CREATE EXTENSION fuzzystrmatch;' end def down execute 'DROP EXTENSION pg_trgm;' execute 'D

安装pq_搜索并运行contrib包迁移后:

class InstallSomeContribPackages < ActiveRecord::Migration
  def up
    execute 'CREATE EXTENSION pg_trgm;'
    execute 'CREATE EXTENSION fuzzystrmatch;'
  end

  def down
    execute 'DROP EXTENSION pg_trgm;'
    execute 'DROP EXTENSION fuzzystrmatch;'
  end
end
PG::UndefinedFunction: ERROR:  function dmetaphone(text) does not exist
LINE 2:   SELECT array_to_string(ARRAY(SELECT dmetaphone(unnest(rege...

我把这个问题贴在了其他与这个问题斗争的人身上

即使使用contrib包,我仍然需要安装fuzzystrmatch扩展

尝试rake db:setup和rake db:test:prepare

如果不起作用,则运行它们:

本地访问终端中的psql并创建扩展:

\psql
create extension fuzzystrmatch;
在heroku上,访问您的psql数据库并从终端创建扩展:

heroku pg:psql
create extension fuzzystrmatch;

然后重新运行迁移。希望这有助于减轻别人的压力。

这真的很有帮助