title: RAILS_ENV=production rake assets:precompile not working through capistrano
body: <p>I have a task in capistrano set up to execute a precompile and a db:migrate. For some reason when I run these tasks manually on the server they work perfectly fine, but when they're run through a rake task they give me errors.</p>
  
  <p>Here are the capistrano tasks:</p>
  
  <pre><code>  after :restart, :clear_cache do
      on roles(:web), in: :groups, limit: 3, wait: 10 do
        execute "cd #{current_path}; RAILS_ENV=production bundle exec rake assets:precompile"
        execute "cd '#{current_path}'; RAILS_ENV=production bundle exec rake db:migrate"
      end
    end
  </code></pre>
  
  <p>Here are the errors:</p>
  
  <pre><code>    INFO [96002080] Running cd /var/www/html/FingertipRails/current; RAILS_ENV=production bundle exec rake assets:precompile on 50.112.106.148
  DEBUG [96002080] Command: cd /var/www/html/FingertipRails/current; RAILS_ENV=production bundle exec rake assets:precompile
  DEBUG [96002080]    bash: bundle: command not found
  </code></pre>
  
  <p>I've tried dropping the <code>bundle exec</code> part of the tasks, but then I get errors saying that gems were not installed (when I clearly ran bundle install before)</p>
  
  <p>Any ideas?</p>