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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:58:14+00:00 2026-05-26T14:58:14+00:00

I have a function in my model that changes is as follows: def compare

  • 0

I have a function in my model that changes is as follows:

  def compare
        self.dirty = 1 if self.dirty == 0
        compare_recursive(0, MergeDigestTree.all)
        self.dirty = 0;
  end

Do I have to call self.save or is it fine like this

  • 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-26T14:58:15+00:00Added an answer on May 26, 2026 at 2:58 pm

    Your question is open to two interpretations:

    • Do you have to call self.save so the record is saved at this point? yes, because an attribute assignation does not commit the change to the database.

    • Are you forced to call self.save and thus save the record? no. It’s ok for a method to change the instance and do not save it. I usually prefer this one, as you give more freedom to the caller.

    Whatever the case, document the method accordingly.

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

Sidebar

Related Questions

I have defined a function in my Navigation model that executes a query, and
I have function getCartItems in cart.js and I want to call that function in
I have a group of model peer classes that should all have the same
Modern browsers have multi-tab interface, but JavaScript function window.showModalDialog() creates a modal dialog that
I have a function in my Comic Model as such: <?php class Comic extends
i have the following function to override the default save function in a model
I have a HTML page, with html-mode enabled. I call function sgml-validate to check
I have a ui that looks like this: +--------+---------------+ | model1 | model details
In my UserProfile model I would like to have a function which returns either
I have a model that works with one user in the database. It is

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.