Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Explicit autosave => false should override new_record autosaving

#2214

previously mentioned in #2144 Don't autosave new_record associations

"autosave" as a feature in rails 2.3 provides the ability to configure a particular model to automatically save the other end of a particular relationship on save.

This behavior existed in earlier version of rails, and would be triggered automatically when a model was saved and it had a relationship to another which was a "new_record?"

Since autosave => true is now a way to make this saving happen for cases beyond new_record:

Here is a patch which makes autosave => false a way to make autosave never happen, including skipping saving of "new_record?" associations.

Reported by Jacob Burkhart · March 11th, 2009 @ 04:25 PM

State: resolved
Milestone: 2.3.6
Assigned to: Eloy Duran Eloy Duran
Importance: Low

Activity

  1. Jacob Burkhart
    Jacob Burkhart
    • No changes were found…

    March 11th, 2009 @ 04:31 PM

  2. Eloy Duran
    Eloy Duran

    I will wok on this, but there are some other things I need to finish first. But it will be added :)

    Thanks

    March 18th, 2009 @ 07:07 PM

  3. Tim Connor
  4. Eloy Duran
    Eloy Duran

    Hey Jacob,

    I've verified your patch and have it in the queue to be applied, however, could you supply me with your full name and email so I can set the right author?

    Thanks

    July 11th, 2009 @ 04:25 PM

  5. Eloy Duran
    Eloy Duran
    • State changed from new to verified
    • Milestone changed from 2.x to 2.3.4

    I have verified and applied this patch on my branch of 2-3-stable, which Micheal will look at and merge in before 2.3.4.

    http://github.com/alloy/rails/commit/295a20b2e9c0dfe7d70e4521333e5f...

    Thanks!

    July 12th, 2009 @ 12:42 PM

  6. Jacob Burkhart
    Jacob Burkhart

    thanks Eloy,

    Jacob Burkhart igotimac at gmail

    July 20th, 2009 @ 07:42 PM

  7. Jeremy Kemper
    Jeremy Kemper
    • Milestone changed from 2.3.4 to 2.3.6

    [milestone:id#50064 bulk edit command]

    September 11th, 2009 @ 11:04 PM

  8. Repository
    Repository
    • State changed from verified to resolved

    (from [2420d6272c8dfa1ebd6735fc9b29e73291b0b93c]) Explicitely setting autosave => false' should override new_record autosaving. [[#2214](/projects/8994/tickets/2214 "Ticket #2214") state:resolved]

    Original author is Jacob.
    http://github.com/rails/rails/commit/2420d6272c8dfa1ebd6735fc9b29e7...

    September 13th, 2009 @ 02:33 AM

  9. Repository
    Repository

    (from [6cc0b9638fbb6ede3c46b51d7dab17881416014c]) Explicitely setting autosave => false' should override new_record autosaving. [[#2214](/projects/8994/tickets/2214 "Ticket #2214") state:resolved]

    Original author is Jacob.
    http://github.com/rails/rails/commit/6cc0b9638fbb6ede3c46b51d7dab17...

    September 13th, 2009 @ 02:33 AM

  10. Michael Johnston
    Michael Johnston
    • Importance changed from to Low

    The way this was implemented means that when autosave is false on a belongs_to association and you do save an association (that is a new record) manually, the foreign key does not get set in the record owning the association.https://rails.lighthouseapp.com/preview

    Was this intentional? It kind of seems to me that the foreign keys should still get set.

    August 5th, 2010 @ 11:43 PM