Ruby 模糊关系 "trigrams" 不存在
Ruby Fuzzily relation "trigrams" does not exist
我正在尝试在我的 rails 应用程序中模糊地使用 Ruby gem,但出现此错误
relation "trigrams" does not exist
我遵循了 https://github.com/mezis/fuzzily
的所有说明
这是我的代码
trigram.rb
class Trigram < ActiveRecord::Base
include Url::Model
include Fuzzily::Model
end
url.rb
class Url < ActiveRecord::Base
fuzzily_searchable :short_url
end
add_trigram_mode.rb
class AddTrigramsModel < ActiveRecord::Migration
extend Url::Migration
extend Fuzzily::Migration
trigrams_owner_id_column_type = :uuid
end
我做了一个耙子 db:migrate。当我在 rails 控制台中执行此操作时,我得到:
Url.find_by_fuzzy_short_url('sojdgl')
Url Load (1.4ms) SELECT "urls".* FROM "urls" ORDER BY "urls"."id" ASC LIMIT 100
PG::UndefinedTable: ERROR: relation "trigrams" does not exist
LINE 5: WHERE a.attrelid = '"trigrams"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"trigrams"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "trigrams" does not exist
LINE 5: WHERE a.attrelid = '"trigrams"'::regclass
我错误地命名了迁移文件。当我将它更改为 20150830110623_add_trigrams_model.rb
时,我工作了
我正在尝试在我的 rails 应用程序中模糊地使用 Ruby gem,但出现此错误
relation "trigrams" does not exist
我遵循了 https://github.com/mezis/fuzzily
的所有说明这是我的代码
trigram.rb
class Trigram < ActiveRecord::Base
include Url::Model
include Fuzzily::Model
end
url.rb
class Url < ActiveRecord::Base
fuzzily_searchable :short_url
end
add_trigram_mode.rb
class AddTrigramsModel < ActiveRecord::Migration
extend Url::Migration
extend Fuzzily::Migration
trigrams_owner_id_column_type = :uuid
end
我做了一个耙子 db:migrate。当我在 rails 控制台中执行此操作时,我得到:
Url.find_by_fuzzy_short_url('sojdgl')
Url Load (1.4ms) SELECT "urls".* FROM "urls" ORDER BY "urls"."id" ASC LIMIT 100
PG::UndefinedTable: ERROR: relation "trigrams" does not exist
LINE 5: WHERE a.attrelid = '"trigrams"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"trigrams"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "trigrams" does not exist
LINE 5: WHERE a.attrelid = '"trigrams"'::regclass
我错误地命名了迁移文件。当我将它更改为 20150830110623_add_trigrams_model.rb
时,我工作了