Sometimes we need to create a monkey patch for a gem or external lib. In these cases, it's good to force it to fail if the gem has been bumped up. Let's use Paperclip as an example:
ruby
ifPaperclip::VERSION != '1.2.3'# If you see this message, please test removing this file# If it's still required, please bump up the version above
fail 'Please remove me, Paperclip version has changed'end
If the gem doesn't provide you the version through a method, you can solve it with:
ruby
ifBundler.load.specs.find { |gem| gem.name == 'paperclip' }.version.to_s != '1.2.3'# If you see this message, please test removing this file# If it's still required, please bump up the version above
fail 'Please remove me, Paperclip version has changed'end
Or even when you're waiting for a new Rails version, e.g.:
ruby
fail 'Remove this file'ifRails::VERSION::MAJOR >= 5