我根据以下教程使用我的 Rails 应用程序设置了 PostGIS:http ://www.daniel-azuma.com/blog/archives/69
当我尝试使用 Guard 运行测试时,出现以下错误:
Exception encountered: #<ActiveRecord::StatementInvalid: PG::Error: ERROR: must be owner of relation spatial_ref_sys: ALTER TABLE "spatial_ref_sys" ENABLE TRIGGER ALL>
我已将 postgis 模式的所有者更改为我的“普通”数据库用户。我还在测试中使用数据库清理器。
完整的回溯如下:
/Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-mini-profiler-0.1.18/lib/patches/sql_patches.rb:155:in
exec' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-mini-profiler-0.1.18/lib/patches/sql_patches.rb:155:in
async_exec ' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:654:inblock in execute' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/abstract_adapter.rb:280:in
块日志'/Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activesupport-3.2.7/lib/active_support/notifications/instrumenter.rb:20:ininstrument' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/abstract_adapter.rb:275:in
log ' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:653:inexecute' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:530:in
确保在 disable_referential_integrity'/Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/activerecord-3.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:530 中:在disable_referential_integrity' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/database_cleaner-0.8.0/lib/database_cleaner/active_record/truncation.rb:132:in
干净'/Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/database_cleaner-0.8.0/lib/database_cleaner/base.rb:39:inclean_with' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/database_cleaner-0.8.0/lib/database_cleaner/configuration.rb:62:in
块clean_with' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/database_cleaner-0.8.0/lib/database_cleaner/configuration.rb:62:ineach' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/database_cleaner-0.8.0/lib/database_cleaner/configuration.rb:62:in
clean_with' /用户/OyoKooN/Projects/sos_medecins/spec/spec_helper.rb:50:inblock (3 levels) in <top (required)>' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb:23:in
instance_eval' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core -2.11.1/lib/rspec/core/hooks.rb:23:inrun' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb:72:in
阻止运行'/Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb: 72:each' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb:72:in
运行中'/Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/hooks.rb :424:inrun_hook' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:27:in
block in run' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/记者.rb:34:report' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/command_line.rb:25:in
运行中'/Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/test_framework/rspec .rb:11:inrun_tests' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:13:in
block in run' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/forker。 rb:21:inblock in initialize' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/forker.rb:18:in
fork' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/forker.rb:18 :在initialize' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:9:in
新的'/Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:9:inrun' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/server.rb:48:in
run ' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1548:inperform_without_block' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1508:in
perform' /Users/OyoKooN/.rbenv/versions/1.9.3- p194/lib/ruby/1.9.1/drb/drb.rb:1586:inblock (2 levels) in main_loop' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1582:in
loop' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb :1582:in `block in main_loop'
谢谢。