title: How to approach developing non-trivial database code in a Rails app
body: <p>I'm curious to see if anyone has developed a Rails application that includes some [potentially non-trivial] plpgsql or pl/v8 or similar code in the database layer, and if they can provide any recommendations on how to approach developing this in a Rails app.</p>
  
  <p>In the past I've typically written just "standard" Rails apps in the normal Rails way, they didn't include any custom functions at the database level.  Right now I'm working on an app and experimenting with doing more at the Postgres layer with some custom functions.  I know this isn't really the "Rails way" though, and as such it's pretty inconvenient.  The way I'm doing it now is to include the functions in a migration file and as I'm developing it I will make changes and reload the code by running the migration down/up.</p>
  
  <p>I'm just wondering if anyone has experience in developing Postgres functions for Rails apps and has found a better workflow that they would be willing to share.</p>