0

I would like to modify the activesupport gem and then place it in vendor, such that my Rails app uses the modified version instead of the one that ships with Rails by default.

Example of my modification:

lib/active_support/dependencies.rb:

  def require(file)
    puts "--- file: #{file.inspect}"
    result = false
    load_dependency(file) { result = super }
    result
  end

Question 1: How do I place a single gem (e.g. activesupport) inside vendor?

Question 2: How do I get Rails to use that "vendorized" gem instead of the default?

user664833
  • 18,397
  • 19
  • 91
  • 140

1 Answers1

0

First Answer Do it to place a gem in vendor

gem unpack activesupport --target vendor/gems

Second Use the vendor gem instead default inGemfile

 gem 'activesupport', :path => "vendor/gems/activesupport-VERSION"
Rajarshi Das
  • 11,778
  • 6
  • 46
  • 74
  • Thanks for your answer. Does it matter where in `Gemfile` I add this line, like before or after `gem 'rails'`, or not? – user664833 Sep 01 '14 at 19:01
  • Note that trying to bundle with `path: 'vendor/gems/activesupport'` led to the error `The path .../vendor/gems/activesupport does not exist.` I changed it to `path: 'vendor/gems/activesupport-4.0.5'` (the true relative location), and then running `bundle` worked. – user664833 Sep 01 '14 at 20:21