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 4038478
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:28:40+00:00 2026-05-20T12:28:40+00:00

I am trying to backup data to a yaml store on deletion like so:

  • 0

I am trying to backup data to a yaml store on deletion like so:

DeleteProject.create!(:data => {
  :project => project.attributes, 
  :domains => project.domains.collect(&:attributes), 
  :databases => project.databases.collect(&:attributes)
}.to_yaml)

However although the project and domain data is stored fine, databases is always coming back blank. The relationship is done via

  • has_and_belongs_to_many :databases
  • has_and_belongs_to_many :projects

I am at a dead end with this one as I do not know why it simply would not be passing in the current data from project.databases. Any insight would be great, thanks!

  • 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-05-20T12:28:41+00:00Added an answer on May 20, 2026 at 12:28 pm

    Okay so I fixed this by doing the following:

    • has_many :database_connections
    • has_many :databases, :through =>
      :database_connections

    Updated models to use has_many and then updated the connecting table no longer database_projects but database_connections.

    class DatabaseConnection < ActiveRecord::Base
      belongs_to :projects, :class_name => "Project",
                            :foreign_key => "project_id"
      belongs_to :databases, :class_name => "Database",
                             :foreign_key => "database_id"
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement a backup of my application's data and user preferences (stored
I am trying to make a backup for my data from my first table
I'm trying to create a universal way of versioning data for my models. I'd
I am trying to create a backup of an android device using ADB. However
I was trying to create a backup for my SQL Server Database using SQL
I'm trying to do something like this, I need to take backup from 4
I'm trying to hack git to do backup for me. The data is so
I'm trying to make a local backup of the data from my Rails application,
I'm trying to transfer an entire column's worth of data from the backup database
I am trying to create a backup of my SQL Server Database in Visual

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.