Reworked so that it actually passes through Rails.