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...
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
you will notice that the downloaded files are empty...
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
Loading production environment (Rails 2.3.5)
Rails requires RubyGems >=...
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...
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...
Sample Rails Database Config for MySQL
Sample Ruby on Rails database config file for connecting to mysql.
#socket: /tmp/mysql.sock #this may vary
upgrading to latest phusion passenger 2.1.2
gem install passenger
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