title: calling methods dynamically inside a controller
body: <p>I have the following scenario</p>
  
  <p>I want to add methods dynamically to a controller. All my method names are in a table . Please refer the following example</p>
  
  <pre><code>-table (method_names)-
  
  1 - Walk
  2 - Speek
  3 - Run
  </code></pre>
  
  <p>and I have a controller</p>
  
  <pre><code>class UsersController &lt; ApplicationController
  
     def index
  
     end 
  
  end
  </code></pre>
  
  <p>Inside this index action i want to call my methods dynamically. Those methods were actually implemented else ware.</p>
  
  <p>I have another controller like</p>
  
  <pre><code>class ActionImplementController &lt; ApplicationController
  
     def walk
       puts "I'm walking"
     end 
  
     def speek
       puts "I'm sppeking"
     end 
  
     def run
       puts "I'm running"
     end 
  
  
  end  
  </code></pre>
  
  <p>** I have done something like below and its working</p>
  
  <pre><code>class UsersController &lt; ApplicationController
  
     def index
       a = eval("ActionImplementController.new.run")
     end 
  
  end
  </code></pre>
  
  <p>But my question is , is this the right way or is there anyother way to do this</p>
  
  <p>Thanks in advance</p>
  
  <p>cheers</p>
  
  <p>sameera </p>