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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:25:04+00:00 2026-06-04T19:25:04+00:00

> %w(action_controller/railtie action_mailer/railtie).map &method(:require) => [true, true] And method call returns an instance of

  • 0
> %w(action_controller/railtie action_mailer/railtie).map &method(:require)
 => [true, true] 

And method call returns an instance of Method.

> method(:require)
 => #<Method: Object(Kernel)#require> 

So there has to be a to_proc definition in method and it should be something like

class Method
  def to_proc
    proc { |obj| self.send(obj) }
  end
end

My question is does rails override this to_proc in Method or what.

why following command is behaving the way it is behaving

> %w(action_controller/railtie action_mailer/railtie).map &method(:require)
 => [true, true] 
  • 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-06-04T19:25:06+00:00Added an answer on June 4, 2026 at 7:25 pm

    method#to_proc returns something that, when you call call on it, the method, passing the supplied arguments. For example

    method(:puts).call("hello world")
    

    outputs hello world. That method “remembers” where it came from, in this case your script’s top level object. Methods like puts,require are define (via Kernel) on Object, so it doesn’t really matter what object the method is bound to (assuming of course that class doesn’t define its own require method!)

    So %w(action_controller/railtie action_mailer/railtie).map &method(:require) is equivalent to calling require passing in those strings one at a time and collecting the return value(which happens to be true – don’t pay too much attention to the return value of require.

    This is not a rails thing – you could do exactly the same thing in a vanilla irb session with any files available to be required. I’m not I would do this – it strikes me as choosing ‘cute’ over ‘understandable’.

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

Sidebar

Related Questions

In my controller action, I call a method that returns me a a list
Rails can't load (404 error) CSS & JS files on production but has no
i need to modify default redirect_to method in actionpack/lib/action_controller/metal/redirecting.rb def redirect_to(options = {}, response_status
Is there really any difference between <form method=post action=/Controller/Action></form> and @using (Html.BeginForm(Action,Controller)) {} when
In my config/environments/development.rb I have the following line: config.action_controller.consider_all_requests_local = true which means I
What is the purpose of this Rails config setting... config.action_controller.consider_all_requests_local = true It's set
In my environment file, setting: config.action_controller.perform_caching = true causes javascript not to load at
environment.rb: config.cache_store = :mem_cache_store, '127.0.0.1', { :namespace => RAILS_ENV.to_s } development.rb: config.action_controller.perform_caching = true
There's a gem, which appends a before_filter to a Rails app: class Railtie <
Is there a way I could pass an argument to a controller action call

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.