Reverse Proxy Fix version 1.0.1

Posted by Brian in Products, Rails (June 14th, 2006)

There was a small bug with the plugin that only affected users in development mode. The plugin now no longer ignores only_path => true when working in development mode. This could present problems in some isolated cases. If you’re not experiencing any problems, you don’t need to upgrade.

ruby script\plugin install

Documentation is available online at

Reverse Proxy Fix plugin

Posted by Brian in Products, Rails (May 10th, 2006)

Updated March 16th, 2009:
This plugin now supports Rails 2.3, 2.2, 2.1, 2.0, 1.2x, and 1.1.

I’ve been working for the last few months on methods to place Rails applications behind Microsoft’s IIS web server. It’s not the easiest thing to do. One of the biggest hurdles is the fact that when Rails generates URLs with the built-in methods like link_to and url_for, they could end up exposing the internal URLs instead of the ones you want your users to go through.


create_update_by Plugin

Posted by Brian in Products, Rails (February 10th, 2006)

Provides optional functionality on “save” and “update_attributes” methods
that allows developers to pass the user id as a parameter.


Assume you have a books table

  create_table :books do |t|
    t.column :created_at, :datetime
    t.column :updated_at, :datetime
    t.column :title, :string
    t.column :created_by, :integer
    t.column :updated_by, :integer

In your controller, you can now do

  b =
  b.title = "My Book'[:user_id]

If you don’t have created_by or updated_by in your table, the stamping will not occur.
No additonal configuration is needed.


Installation is easy… just use the built-in Plugin installer for Rails.

ruby script/plugin install


Thanks to DeLynn Berry, the creator of the original Userstamp plugin for the idea.
The Userstamp plugin can be found at

This plugin was created because I wanted to provide more control
over the assignment of created_by and updated_by.

Excel Export Plugin

Posted by Brian in Products, Rails (February 10th, 2006)

I’m pleased to announce the new Excel Export plugin for Ruby on Rails. This plugin allows Rails developers to easily export their data to an Excel spreadsheet.

To install via SubVersion,

ruby script/plugin install

Simple example

Let’s assume we have two models… a Project and a Task. A Project has_many :tasks. In one of our controllers, we can create the following method which will stream a new Microsoft Excel document to the client’s browser.

  def export_project_to_excel
e =
@project = Project.find(:all)
@tasks = @project.tasks
e.addWorksheetFromActiveRecord "Project", "project", @project
e.addWorksheetFromActiveRecord "Tasks", "task", @tasks
headers['Content-Type'] = "application/"

More Advanced example

This time, let’s create an array of hashes. This way, we can manipulate our data ourselves, instead of letting the plugin do the mapping. This is really useful when you have “has_many” or “belongs to” relationships and you want to export meaningful values instead of the foreign keys.

  def export_book_info_to_excel
    e =
    books = Book.find(:all)
    array =
    for book in books
      item =
      item["Title"] = book.title
      item["ISBN"] = book.isbn
      item["Author"] =
      item["Category"] =
      item["Total Sales"] = book.sales.size
      array << item
    e.addWorksheetFromArrayOfHashes("Books info", array)
headers['Content-Type'] = "application/"
« Previous Page