Skip to content

Instantly share code, notes, and snippets.

@rknLA
Last active April 13, 2016 11:06
Show Gist options
  • Save rknLA/f38fef042db59b2a3b59a968819ede5c to your computer and use it in GitHub Desktop.
Save rknLA/f38fef042db59b2a3b59a968819ede5c to your computer and use it in GitHub Desktop.
class BarContoller
def update
# ...
SomeExternalModule::SomeClassInTheModule.my_method
# kaboom:
# NoMethodError (undefined method `my_method' for #<Class:0x007fd3964eb468>):
end
end
module SomeExternalModule
class SomeClassInTheModule # which inherits ActiveRecord::Base
def self.my_method
# do whatever here...
end
end
end
#? lxsameer's suggestion
SomeExternalModule::SomeExternalClass.class_eval do
def my_method
# do whatever here...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment