Named Scope Woes

I'm trying to dynamically build up a complex search screen using named
scopes very much like in ryans recent railscast at

I'm finding issue though that the second named scope is wiping out the
joins in the first scope.

For Example:
scope = ProjectTotalView.scoped({})

scope = scope.scoped({
:joins => "INNER JOIN proj_funding_schemes_vw ON
(proj_funding_schemes_vw.fin_project_id =
            :conditions => "proj_funding_schemes_vw.currency_code in

scope = scope.scoped({
         :joins => "INNER JOIN project_rfcds_vw ON
(project_rfcds_vw.fin_project_id = project_totals_vw.fin_project_id)",
        :conditions => "project_rfcds_vw.rfcd_code in ('250400')"


If you swap the scopes around, it's always the other one that says
unknown column rfcd_code etc. It's because it only does the first join
that this error occurs.

Any idea on how I can fix (if it is an issue) named_scope so it does
combine the :joins instead. I've tried looking though
/active_record/named_scope.rb and I can't actually work out at the point
where those conditions get added to the "sql builder"

I've also found this is talked about here:

A ticket marked as incomplete on lighthouse:

A simple fix for:

Alex Moore wrote: