我根据以下教程使用我的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 :在
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:in {{1阻止日志' /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:in {{1 }}日志” /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:in {{1确保在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:in {{1 }}清洁' /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: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
阻止在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: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
clean_with” /Users/OyoKooN/Projects/sos_medecins/spec/spec_helper.rb:50: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
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:in { {1}}阻止运行' /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 { {1}}运行” /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:in { {1}}阻止运行' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.11.1/lib/rspec/core/reporter.rb:34:in { {1}}运行” /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:in {{1阻止运行' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/spork-1.0.0rc3/lib/spork/forker.rb:21:indisable_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/spork-1.0.0rc3/lib/spork/forker.rb:18: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
新' /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 {{1 }}跑' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1548: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
执行' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1586: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
loop' /Users/OyoKooN/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/drb/drb.rb:1582:in在main_loop'中的块
感谢。