我是一位在Rails 4.2.4中構建條帶支付處理系統的新開發人員。Heroku run rake db:種子錯誤
我的應用程序在本地完美運行,但是當我將其推送到Heroku時,在運行rake db:seed
後出現此錯誤。
雖然之前運行良好,但我現在還是無法使應用程序在生產級別打開。
這是在終端的錯誤:
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Email has already been taken
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/validations.rb:79:in `raise_record_invalid'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/validations.rb:43:in `save!'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/transactions.rb:291:in `block in save!'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/transactions.rb:220:in `transaction'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/transactions.rb:291:in `save!'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/persistence.rb:51:in `create!'
/app/db/seeds.rb:9:in `<top (required)>'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `load'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `block in load'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `load'
/app/vendor/bundle/ruby/2.2.0/gems/railties-4.2.4/lib/rails/engine.rb:547:in `load_seed'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/tasks/database_tasks.rb:250:in `load_seed'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.4/lib/active_record/railties/databases.rake:183:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:seed
這是seeds.rb:
AdminUser.create!(email: '[email protected]', password: 'password', password_confirmation: 'password')
placenta_wash = Product.create(title: "Placenta Wash",
subtitle: "Nippon Beauty", author: "Chris Dorman",
length: "30 minutes", author_image_name: "teacher-image.jpg",
price: "4.99", sku: "GROHACK1", download_url: "https://s3.amazonaws.com/one-month-stripe-payments-dorman/CV.pdf",
details: "You'll get one video", description: %{<p>A growth hacker is a rare combination: someone with the right marketing and technical skills who can come up with clever marketing hacks and also track their results.</p>
<p>In this talk, Mattan Griffel introduces you to the concept of Growth Hacking and shares his favorite tips for getting started as a growth hacker.</p>
<p><strong>What You'll Learn</strong></p>
<ul class="no-indent">
<li>What is a growth hacker?</li>
<li>The 5 stages of the user lifecycle</li>
<li>How to apply the Lean Marketing Framework</li>
<li>Resources and tools you'll need to know</li>
</ul>},
author_description: %{ <p>Hey, I'm Mattan Griffel, co-founder of the Y Combinator backed <a href="http://www.onemonth.com" target="_blank">One Month</a> where I teach the best selling One Month Rails and One Month Growth Hacking.</p>
<p>Why take my class? In the past I've advised companies like Pepsico, Bloomberg, GM, NYSE, and JPMorgan on growth hacking best practices. I've also spoken at New York University, Cooper Union and First Round Capital. My goal is to help you and other entrepreneurs rapidly grow your business.
</p>
<p>Follow me on Twitter <a href="https://twitter.com/mattangriffel" target="_blank">@mattangriffel</a></p>})
growth_hacking_monthly = Product.create(title: "Growth Hacking Monthly",
subtitle: "Ongoing Course", author: "Chris Dorman",
length: "6 months", author_image_name: "teacher-image.jpg",
price: "4.99", sku: "GROHACK2", download_url: "https://s3.amazonaws.com/one-month-stripe-payments/Peter+Bell+Resume.pdf",
details: "We'll charge you monthly for unlimited access to our mentoring team", description: %{<p>A growth hacker is a rare combination: someone with the right marketing and technical skills who can come up with clever marketing hacks and also track their results.</p>
<p>In this series, Mattan Griffel introduces you to the concept of Growth Hacking and shares his favorite tips for getting started as a growth hacker.</p>
<p><strong>What You'll Learn</strong></p>
<ul class="no-indent">
<li>What is a growth hacker?</li>
<li>The 5 stages of the user lifecycle</li>
<li>How to apply the Lean Marketing Framework</li>
<li>Resources and tools you'll need to know</li>
</ul>},
author_description: %{ <p>Hey, I'm Mattan Griffel, co-founder of the Y Combinator backed <a href="http://www.onemonth.com" target="_blank">One Month</a> where I teach the best selling One Month Rails and One Month Growth Hacking.</p>
<p>Why take my class? In the past I've advised companies like Pepsico, Bloomberg, GM, NYSE, and JPMorgan on growth hacking best practices. I've also spoken at New York University, Cooper Union and First Round Capital. My goal is to help you and other entrepreneurs rapidly grow your business.
</p>
<p>Follow me on Twitter <a href="https://twitter.com/mattangriffel" target="_blank">@mattangriffel</a></p>})
您是第一次運行'heroku run rake db:seed'還是之前跑過它? – harshs08
你可以發佈你的seeds.rb文件嗎? – M00B
你想要我的種子文件張貼爲JPG還是塊引用。謝謝 –