Calling rails from a server-side include?

Hi,

  99% of my site is rails, but I have a tiny php section I just cant
get rid of (phpbb3). I've turned on server-side includes on my site and my
phpbb3 template starts with this:

<!--#include virtual="/main/header" -->
...

  The problem is, rails isn't recognizing that it was called as
"/main/header"; I get this error in my development.log:

ActionController::RoutingError (no route found to match "/forum/index.php"
with {:method=>:get}):

  Does anybody know how to get around this? I was thinking of just
adding a "/forum/*" route to explicitly point to the header, but then
there's the problem of the footer... Any ideas would be greatly appreciated.
:slight_smile:

  Thanks,
    Tyler

Okay, after hacking around a bit, I figured something out, but it's REALLY
hacky. :slight_smile:

Step #1: Include this code when rails starts up:

module ActionController
  class CgiRequest < AbstractRequest
    alias old_request_uri request_uri
    def request_uri
      if params['RAILS_ROUTE']
        if Array === params['RAILS_ROUTE']
          return params['RAILS_ROUTE'][0]
        else
          return params['RAILS_ROUTE']
        end
      else
        return old_request_uri
      end
    end
  end
end

Step #2: reference rails from SSI this way:

<!--#include virtaul="/dispatch.fcgi?RAILS_ROUTE=/main/header" -->

This is fragile and hacky, but it works for what I need!

  Cheers,
    Tyler