# How do I override a method that's only invoked from a rake task

**URL:** <https://www.ruby-forum.com/t/how-do-i-override-a-method-thats-only-invoked-from-a-rake-task/128171>\
**Category:** Rails\
**Created:** [February 5, 2008, 3:45pm UTC](https://www.ruby-forum.com/t/how-do-i-override-a-method-thats-only-invoked-from-a-rake-task/128171 "2008-02-05T15:45:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fitter\_man](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/848f3c/32.png) [@fitter\_man](https://www.ruby-forum.com/u/fitter_man)\
**Post date:** [February 5, 2008, 3:45pm UTC](https://www.ruby-forum.com/t/how-do-i-override-a-method-thats-only-invoked-from-a-rake-task/128171/1 "2008-02-05T15:45:40Z")

</div>

I want to override structure\_dump in the MysqlAdapter class. (It  
doesn’t dump some stuff I need for my implementation and I’m extending  
it to do that.)

I know how to override methods in application code.  
MysqlAdapter#structure\_dump is called from the rake task  
db:structure:dump, and I can’t figure out where to put the overriding  
implementation so that it gets called when the rake task is invoked.  
What’s the secret?
