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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:01:39+00:00 2026-05-21T20:01:39+00:00

I’ve seen a few places where *_without_* methods are being referenced in gems, and

  • 0

I’ve seen a few places where *_without_* methods are being referenced in gems, and I don’t see where they’re being defined. Here are two examples from the validationgroup and delayed_jobs gems.

  1. In validation_group.rb, there is a method add_with_validation_group that is defined that references add_without_validation_group on its last line; however, add_without_validation_group does not appear to be defined anywhere.

    def add_with_validation_group(attribute,
                                  msg = @@default_error_messages[:invalid], *args,
                                  &block)
      add_error = true
      if @base.validation_group_enabled?
        current_group = @base.current_validation_group
        found = ValidationGroup::Util.current_and_ancestors(@base.class).
          find do |klass|
            klasses = klass.validation_group_classes
            klasses[klass] && klasses[klass][current_group] &&
            klasses[klass][current_group].include?(attribute)
          end
        add_error = false unless found
      end
      add_without_validation_group(attribute, msg, *args,&block) if add_error
    end
    
  2. In DelayedJob’s message_sending.rb, dynamically passed method parameters are being called as #{method}_without_send_later. However, I only see where #{method}_with_send_later is being defined anywhere in this gem.

    def handle_asynchronously(method)
      without_name = "#{method}_without_send_later"
      define_method("#{method}_with_send_later") do |*args|
        send_later(without_name, *args)
      end
      alias_method_chain method, :send_later
    end
    

So my belief is that there’s some Rails magic I’m missing with these “without” methods. However, I can’t seem to figure out what to search for in Google to answer the question on my own.

  • 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-21T20:01:39+00:00Added an answer on May 21, 2026 at 8:01 pm

    that’s what alias_method_chain is providing you.

    Basically when you say

    alias_method_chain :some_method, :feature
    

    You are provided two methods:

    some_method_with_feature
    some_method_without_feature
    

    What happens is that when the original some_method is called, it actually calls some_method_with_feature. Then you get a reference to some_method_without_feature which is your original method declaration (ie for fallback/default behavior). So, you’ll want to define some_method_with_feature to actually do stuff, which, as I say, is called when you call some_method

    Example:

    def do_something
      "Do Something!!"
    end
    
    def do_something_with_upcase
      do_something_without_upcase.upcase
    end
    
    alias_method_chain :do_something, :upcase
    
    do_something # => "DO SOMETHING!!"
    

    See the documentation here:

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am using Paperclip to handle profile photo uploads in my app. They upload
I've tracked down a weird MySQL problem to the two different ways I was
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.