How to Import/Export a Database from One Heroku App to Another Heroku App  
  
    Heroku is awesome! Let's say we want to copy a production database to a staging database. 
We can use the `pg:backups:restore` command to accomplish this. Here is an example.  For the source database we are using the `production-app-name` and for stagi...  
  
    
      Written by Sean Behan on 03/07/2017
    
  
 
  
    Rails Send_File in Production Delivers an Empty File  
  
    If you're running Rails in production it will by default be configured to let apache or nginx send files for you. If you're handling file downloads yourself with send_file
send_file("path/to/file.txt")
you will notice that the downloaded files are empty...  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    Ruby Enterprise Edition and Passenger ./script/console production fails and instead returns Loading production environment (Rails 2.3.5) Rails requires RubyGems >= 1.3.2. Please install RubyGems and try again: http://rubygems.rubyforge.org   
  
    After installing Ruby Enterprise Edition, REE, and Passenger on Ubuntu you may see this error message when you run script/console for the first time
./script/console production
# => 
Loading production environment (Rails 2.3.5)
Rails requires RubyGems >=...  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    Defining Application Constants for Ruby on Rails Application  
  
    The best place to keep application constants which are environment specific is in config/environments directory. For instance...
# in RAILS_ROOT/config/environments/development.rb
APP_DOMAIN = "localhost"
# in RAILS_ROOT/config/environments/production.rb...  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    Rails: Expiring a cached page with namespaces and sweepers  
  
    I've got some pages that are cached using their permalinks on the filesystem, such as http://example.com/about-us.html which will need to map to RAILS_ROOT/public/about-us.html ... The issue I have is that I use a namespace for the admin area and the cont...  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    Sample Rails Database Config  for MySQL  
  
    Sample Ruby on Rails database config file for connecting to mysql.
production:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: db_production
  pool: 5
  username: db_user
  password: db_password
  #socket: /tmp/mysql.sock #this may vary
...  
  
    
      Written by Sean Behan on 06/17/2012
    
  
 
  
    upgrading to latest phusion passenger 2.1.2  
  
    super easy
gem install passenger
passenger-install-apache2-module
will walk you through the install and remember to copy paths to your apache config file. for passenger i kept it in
mods-available/passenger.conf and then linked it to mods-enabled
ln -s...  
  
    
      Written by Sean Behan on 06/17/2012