Ruby cannot load such file - active_support/core_ext/object/blank
Running brew style
fixed this issue for me.
Update
As mentioned in the comments, for some people the solution is:
brew update-reset
Can't load `active_support/core_ext` in ruby 2.1.5
Presuming you're using bundler, try this diagnostic code to see what works:
require 'rubygems' # You may be able to omit this line
require 'bundler/setup' # You may be able to omit this line
require 'active_support'
require 'active_support/core_ext'
Newer Ruby versions may be able skip rubygems
, setup
, and core_ext
, and just use this:
require 'active_support'
why can I require 'active_support/core_ext'?
Look for the file named core_ext.rb
.
But no require
can't load directories.
How to fix Ruby error: `require': cannot load such file -Programing Ruby 1.9 & 2.0 4th edition
gserver
used to be part of Ruby's standards library for some time. However, it was removed from the standards library with Ruby 2.2.0 since it was basically unmaintained and had no tests.
This (un-)maintenance status has not really changed since. If you still need the functionality of the library, you can install and use the gserver
gem which contains the code state as it was removed form the standards library. However, I would strongly recommend to use something else instead...
Sidekiq -r a single demo_worker.rb file, and require active support in that worker doesnt work
This error happens cause the gem activesupport
has not been installed yet (on your local machine), so just run command gem install activesupport
, and it'll be ok.
But note that active_support
in Rails use autoload
so if we're going to use it's submodules outside Rails we need to require them directly, for example i want to use extension Integer#hours
i need to require active_support/core_ext/integer/time
require 'sidekiq'
require "active_support/core_ext/integer/time"
class Demo
include Sidekiq::Worker
def perform(how_hard="super hard", how_long=1)
sleep how_long
puts "Workin' #{how_hard} #{8.hours}"
end
end
Related Topics
What's the Point of Freezing Your Rails Version/Gems
In Ruby, Is There No Way to Dynamically Define a Local Variable in the Current Context
How to Access Nested Elements of a Hash with a Single String Key
Railstutorial - Chapter 8.4.3 - Test Database Not Clearing After Adding User in Integration Test
Render Three Different Partials Depending on Button Clicked
Rails Article Helper - "A" or "An"
What Does "<Top (Required)>" Mean in a Ruby Stack Trace
Is Everything an Object in Ruby
Ruby - Send Get Request with Headers
Error: Failed to Build Gem Native Extension (Ruby Extconf.Rb): MAC Osx
How to Elegantly Rename All Keys in a Hash in Ruby
What Exactly Is Arel in Rails 3.0
Rspec: "Array.Should == Another_Array" But Without Concern for Order
Rails - Redirecting Console Output to a File