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

The Archive Base Latest Questions

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

Issue: To avoid creating multiple objects or multiple queries when possible. I am using

  • 0

Issue: To avoid creating multiple objects or multiple queries when possible.

I am using Presenters with rails as a Best Practice.

I am following advice that says that it would be good to use “extend ActiveSupport.Memoizable” (and then memoize :method(s) to use them) over setting up items with @the_record = record ||= @record style because of a couple of issues – false or nil not getting stored so the query gets called again and also that memoizable uses the cache better (i.e. uses it!).

However I see that memoizable is getting deprecated in rails 3.1
Notes i github under carrierwave and with statement:
“DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from extend at /Users/kain/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/carrierwave-c4459179b0f8/lib/carrierwave/mount.rb:284”.

Maybe it’s been resolved though? Anyone know?

Any suggestions about the best practice to use going forward? Use the ||= syntax? What about the above issues?

enter image description here

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

    The ||= method is great for things that return values that evaluate as true, but it doesn’t work very well for things that don’t. memoize does work around this by trapping these conditions and returning accordingly. You might take an approach like this if you want to accommodate nil:

    def some_method
      return @some_method if (instance_variable_defined?(:"@some_method"))
    
      @some_method = begin
        ...
      end
    end
    

    This just checks if the variable is defined, not if it is set, which is an important distinction in your case.

    I’m not sure why you think it’s being deprecated [Note from Michael, it’s deprecated in 3.2, see note below]. The documentation indicates it’s still current in 3.1. Sometimes implementations are marked as “deprecated” when they’re being moved from one module to another, but the facility remains available.

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

Sidebar

Related Questions

Our issue is that our project has files being downloaded using wget to the
Using Internet Explorer (don't appear to have an issue in FireFox) the following code
So essentially my question is this, I am creating an NSMutableDictionary using uint64_t objects
The issue that prompted me to ask this is a web form that was
The issue is simple really. Instead of creating folders in Visual Studio, I create
My issue is not able to render the chart in .tpl file. The following
When making calls to a webservice from an asp.net web application, to avoid creating
I am currently creating a web application that will be deployed in an intranet
I'm writing a Drupal module that deals with creating new nodes from CSV files.
Ok so I'm working on an ASP MVC Web Application that queries a fairly

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.