Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8628617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:35:31+00:00 2026-06-12T08:35:31+00:00

Have already looked at this stack question , at which point I looked at

  • 0

Have already looked at this stack question, at which point I looked at all of the links in the answer.

Created custom rake task, code looks like this:

task :seeding do
    op_a = CoverageDetail.create(option: 'a', privacy_and_website_media: 250000.00, privacy_breach_service: 20000,
                    legal_forensic_cost: 25000.00, call_center_service: 'inc', deductible: 5000.00,
                    credit_monitoring_individuals: 20000, fraud_resolution_service: 5000, regulatory_defense: 100000.00,
                    pci_fines_and_costs: 50000.00, crisis_management_and_pr: 50000.00, foreign_notification: 10000.00)

    op_b = CoverageDetail.create(option: 'b', privacy_and_website_media: 500000.00, privacy_breach_service: 25000,
                            legal_forensic_cost: 50000.00, call_center_service: 'inc', deductible: 5000.00,
                            credit_monitoring_individuals: 25000, fraud_resolution_service: 5000, regulatory_defense: 250000.00,
                            pci_fines_and_costs: 50000.00, crisis_management_and_pr: 50000.00, foreign_notification: 10000.00)

    op_c = CoverageDetail.create(option: 'c', privacy_and_website_media: 1000000.00, privacy_breach_service: 50000,
                            legal_forensic_cost: 100000.00, call_center_service: 'inc', deductible: 5000.00,
                            credit_monitoring_individuals: 50000, fraud_resolution_service: 5000, regulatory_defense: 500000.00,
                            pci_fines_and_costs: 50000.00, crisis_management_and_pr: 50000.00, foreign_notification: 10000.00)

    op_a.save!
    op_b.save!
    op_c.save!
end

I have a table called coverage_details I have a model called coverage_detail.rb I have a controller called coverage_details_controller.rb. The class name in the model is CoverageDetail.

Problem: Why am I getting uninitialized constant CoverageDetail?

This is my first time trying to create a custom rake task to seed a new table in an existing app, or I would just add this info to my db:seed file.

What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:35:32+00:00Added an answer on June 12, 2026 at 8:35 am

    use environment to give it rails environment

    task :seeding => :environment do
        op_a = CoverageDetail.create(option: 'a', privacy_and_website_media: 250000.00, privacy_breach_service: 20000,
                        legal_forensic_cost: 25000.00, call_center_service: 'inc', deductible: 5000.00,
                        credit_monitoring_individuals: 20000, fraud_resolution_service: 5000, regulatory_defense: 100000.00,
                        pci_fines_and_costs: 50000.00, crisis_management_and_pr: 50000.00, foreign_notification: 10000.00)
    
        op_b = CoverageDetail.create(option: 'b', privacy_and_website_media: 500000.00, privacy_breach_service: 25000,
                                legal_forensic_cost: 50000.00, call_center_service: 'inc', deductible: 5000.00,
                                credit_monitoring_individuals: 25000, fraud_resolution_service: 5000, regulatory_defense: 250000.00,
                                pci_fines_and_costs: 50000.00, crisis_management_and_pr: 50000.00, foreign_notification: 10000.00)
    
        op_c = CoverageDetail.create(option: 'c', privacy_and_website_media: 1000000.00, privacy_breach_service: 50000,
                                legal_forensic_cost: 100000.00, call_center_service: 'inc', deductible: 5000.00,
                                credit_monitoring_individuals: 50000, fraud_resolution_service: 5000, regulatory_defense: 500000.00,
                                pci_fines_and_costs: 50000.00, crisis_management_and_pr: 50000.00, foreign_notification: 10000.00)
    
        op_a.save!
        op_b.save!
        op_c.save!
    end
    

    The environment gives it rails running environment and Your model CoverageDetail comes in the scene.

    thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this question has already been answered elsewhere. I looked through stack overflow
I have looked for an answer on Stack for a while. All the answers
I have already looked at this similar question but i am still wondering if
Quick question (and sorry if it's already been asked, I have looked but couldn't
I have looked all of the place for this and I can't seem to
Before I posted this question, I already looked this , but I couldn't get
I have looked through many tutorials, as well as other question here on stack
I have already looked into this solution: Show if ItemsControl.ItemsSource is null . I
I have already looked at other related questions, and none of them helped this
i know, similar questions have been asked, and i've already looked through everything i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.