title: Rails3: How to execute Rails commands (like "rails generate") with shell script
body: <p>I need to be able to generate a model (and later a migration) by executing a Linux shell script.</p>
  
  <p>The script is located directly in the app folder and looks like this:</p>
  
  <pre><code>#!/bin/bash
  
  cd /home/&lt;my_user_profile&gt;/Websites/&lt;my_app_name&gt;
  rails g model my_model name:string accepted:boolean [etc...]
  </code></pre>
  
  <p>The problem is: When I execute the script, the model does not get created. Any ideas why?</p>