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

  • Home
  • SEARCH
  • 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 4077494
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:33:26+00:00 2026-05-20T17:33:26+00:00

I just implemented a number of custom counter_cache s using code like this: def

  • 0

I just implemented a number of custom counter_caches using code like this:

def after_save
    self.update_counter_cache
end
def after_destroy
    self.update_counter_cache
end
def update_counter_cache
    self.company.new_matchings_count = Matching.where(:read => false).count
    self.company.save
end

My question is this – what does the command Model.save(:validate => false) actually prevent beyond things like validates_with or before_validation?

Will my custom counter_caches be affected if I keep my existing saves without validation?

  • 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-20T17:33:27+00:00Added an answer on May 20, 2026 at 5:33 pm

    If you pass in the :validate=>false, it skips the valid? command. Everything else functions the same.

    You can check the code out here: http://api.rubyonrails.org/classes/ActiveRecord/Validations.html

    def save(options={})
      perform_validations(options) ? super : false
    end
    
    ...
    
    if perform_validation
      valid?(options.is_a?(Hash) ? options[:context] : nil)
    else
      true
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have two custom complex types like this (oversimplified for this example): public
I created my own custom view that extends UIControl. This custom view has its
What's a sound approach to override the CompareTo() method in a custom class with
In my ASP.NET MVC 2 web application, I allow users to create custom input
This is going to be quite a vague question but I am wondering how
I have a custom editor with problem markers. The markers display correctly in the
Summary. Based on some benchmarks , I chose yajl-objc for my iPhone JSON parser.
EDIT: I seem to have found something that's helped. I retained the ivar stack
I'm currently developing a solution and have designed it in a way such that
I'm trying to add line numbers to a JTextArea and am having some difficulties.

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.