我正在尝试从Project
模型中找到一个项目 usingProject.find(id)
但它给了我ActiveRecord::StatementInvalid
错误
全程追踪——
PG::Error: ERROR: prepared statement "a1" already exists : SELECT COUNT(*) FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind in ('v','r') AND c.relname = $1 AND n.nspname = ANY (current_schemas(false))
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:1180:in `prepare'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:1180:in `prepare_statement'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:1144:in `exec_cache'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord- 3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:664:in `block in exec_query'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activesupport-3.2.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:662:in `exec_query'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:797:in `table_exists?'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/connection_adapters/schema_cache.rb:30:in `table_exists?'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/model_schema.rb:223:in `table_exists?'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/attribute_methods/primary_key.rb:75:in `get_primary_key'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/attribute_methods/primary_key.rb:60:in `reset_primary_key'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/attribute_methods/primary_key.rb:49:in `primary_key'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/model_schema.rb:230:in `block in columns'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/model_schema.rb:228:in `map'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/model_schema.rb:228:in `columns'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/model_schema.rb:237:in `columns_hash'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/relation/delegation.rb:7:in `columns_hash'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/relation/finder_methods.rb:330:in `find_one'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/relation/finder_methods.rb:311:in `find_with_ids'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/relation/finder_methods.rb:107:in `find'
/home/deploy/.rvm/gems/ruby-1.9.2-p290@submit_contactpl/gems/activerecord-3.2.2/lib/active_record/querying.rb:5:in `find'
/home/deploy/submit_contactpl/app/workers/php_worker.rb:5:in `perform'
第 5 行php_worker
是
project = Project.find(project_id)
可能是什么问题?你能不能给它遮光。可能的解决方案是什么