2017-01-31 9 views
6

मैं अपने आरओआर ऐप के भीतर किसी ऑब्जेक्ट को नष्ट करने की कोशिश कर रहा हूं।मेलबॉक्सर: ऑब्जेक्ट को नष्ट नहीं कर सकता

ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "mailboxer_conversation_opt_outs" does not exist 
LINE 5:    WHERE a.attrelid = '"mailboxer_conversation_o... 
             ^
:    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 = '"mailboxer_conversation_opt_outs"'::regclass 
       AND a.attnum > 0 AND NOT a.attisdropped 
       ORDER BY a.attnum 

    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `async_exec' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `block in exec_no_cache' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `exec_no_cache' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:584:in `execute_and_clear' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `exec_query' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:733:in `column_definitions' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql/schema_statements.rb:186:in `columns' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/schema_cache.rb:43:in `columns' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/schema_cache.rb:49:in `columns_hash' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/associations/association_scope.rb:85:in `column_for' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/associations/association_scope.rb:94:in `bind' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/associations/association_scope.rb:103:in `last_chain_scope' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/associations/association_scope.rb:139:in `add_constraints' 
... 72 levels... 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:281:in `block in destroy' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:220:in `transaction' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:348:in `with_transaction_returning_status' 
    from /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:281:in `destroy' 
    from (irb):5 
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/console.rb:110:in `start' 
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/console.rb:9:in `start' 
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:68:in `console' 
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!' 
    from /app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.5.1/lib/rails/commands.rb:17:in `<top (required)>' 
    from bin/rails:4:in `require' 

मैं इस अनुमान है कि इस mailboxer_conversation_opt_outs तालिका मैं अपने अनुप्रयोग के भीतर नहीं है से संबंधित है:

लेकिन मैं निम्नलिखित त्रुटि मिलती है।

मैं रेल 4.2 उपयोग कर रहा हूँ और:

mailboxer (0.13.0) 
    carrierwave (>= 0.5.8) 
    foreigner (>= 0.9.1) 
    rails (>= 3.2.0) 

वहाँ एक प्रवास फ़ाइल मैं किसी भी तरह याद है?

वैसे भी, मेरी वस्तु इस तालिका से कैसे जुड़ी हुई है जबकि वास्तविक वस्तु संदेश नहीं भेज सकती है?

धन्यवाद

+1

क्या आपने 'रेक डीबी: माइग्रेट' चलाने का प्रयास किया था? क्या आपके पास 'schema_migrations' तालिका में '20131206080416_add_conversation_optout' है? –

+0

नहीं। मुझे लगता है कि इस माइग्रेशन को जोड़ा गया है * बाद में * मैंने पहली बार मेलबॉक्सर सेट किया है (~ 3 साल पहले), है ना? मुझे इस पर कैसे पकड़ना चाहिए? –

+0

ठीक है, मैं देखता हूं कि माइग्रेशन आपकी 'schema_migrations' तालिका में मौजूद है या नहीं। और मेरे स्थानीय पर मैं डीबी छोड़ दूंगा और इसे फिर से बनाउंगा और माइग्रेशन को फिर से चलाऊंगा और देख सकता हूं कि यह –

उत्तर

2

ऐसा लगता है कि आप Mailboxer के पिछले संस्करण का उपयोग करें।

नया एक पर स्थानांतरित करने के लिए प्रयास करें:

$ rails generate mailboxer:namespacing_compatibility 
$ rails generate mailboxer:install -s 
$ rake db:migrate 

प्रलेखन से लिया: https://github.com/mailboxer/mailboxer#upgrading

+0

वह पहले से ही '0.13.0' पर है –

4

Is there a migration file I somehow missed?

हाँ, itsnikolay's answer और प्रलेखन के Upgrading खंड देखें।

Anyway, how come my object is connected to this table while the actual object cannot send messages?

आपका मॉडल वर्ग शायद अभी भी acts_as_messageable विधि है, जो आपके ActiveRecord वर्ग है, जो declares several extra associations अपने मॉडल पर में Mailboxer::Models::Messageable मॉड्यूल शामिल बुला रहा है। यदि आपको मेलबॉक्सर को अपग्रेड करने की परवाह नहीं है और बस अपने मॉडल को मेलबॉक्सर से पूरी तरह से डिस्कनेक्ट करना चाहते हैं, तो बस acts_as_messageable लाइन हटाएं और आपको बिना किसी असफल एसोसिएशन के मुद्दों के अपने रिकॉर्ड को नष्ट करने में सक्षम होना चाहिए।

संबंधित मुद्दे