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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:08:34+00:00 2026-05-26T09:08:34+00:00

I have a form being submitted for a complex model including many associations. I

  • 0

I have a form being submitted for a complex model including many associations. I need to save 2 copies of the object. One that will not be touched and is used only as a reference for what was originally submitted, the other will be edited by my users.

I originally preformed a deep clone of the object and all associations, and then saved both to the database, marking a field for which was the original, and which can be edited. This is becoming too complex however and I would like a simpler solution

I was thinking my best bet would be to serialize the entire object and store it in a single field within the editable object. So my question is: Is it possible to serialize an object, including associations, and store it in a single field?

Should I do this at the model level? or should I just save what was returned from the form in a single field? (ie. application.original_form = params[:application]).

Thanks for your help!
Ryan

EDIT —

I am attempting this approach:

https://gist.github.com/1298567

I am saving the returned parameters in a serialize field.

Does anyone see any downfall with this? It seems like the simplest approach.

Thanks again!

Ryan

  • 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-26T09:08:35+00:00Added an answer on May 26, 2026 at 9:08 am

    I’ve gone with this approach:

     def create
        @app = App.new(params[:app])
        @app.original = params[:app]
        respond_to do |format|
          if @app.save
            format.html { redirect_to(done_path(@app.member.id)) }
          else
            format.html { render :action => "new" }
          end
        end
    end
    
    #show the original Application
    def show
       @app = App.new(App.find(params[:id]).original)
    end
    
    #Model
    
    class App < ActiveRecord::Base
      has_one :applicant
    
      serialize :original, Hash
    
      accepts_nested_attributes_for :applicant
    end
    

    To me this seems like the simplest approach to the issue.

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

Sidebar

Related Questions

I have a contact form that is being submitted, I have PHP validation all
this is a simple question. I have a form that is being validated using
I have a file upload form that is being posted back to a servlet
I'm having problems binding on a form with multiple models being submitted. I have
I have a form which is being submitted by ajax. Before submission, there's a
I've got a form inside an <asp:Content> block that is being submitted to a
I have a Form being launched from another form on a different thread. Most
I have a Reset Password form being validated by the jQuery Validation plugin. Everything
How would i go about stopping a form from being moved. I have the
Hello i have a list view control, While the form is being loaded 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.