Workaround for Rails Bug dropping of AR nodes when chaining with scopes

Squashed commit of the following:

commit bd266cc69eb382564e7a44ee64c5efa5c8237ba3
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Jul 3 15:14:39 2013 +0200

    Removed unused assignment in filter module

commit 70a41bc1e8688e725855783f4fbc04d4facec669
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Jul 3 15:01:01 2013 +0200

    Reverted to scope definition for ordered_by of media_resource

commit 2e82e0a07eaea09b70828667c3f0755888183c0a
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Jul 3 14:41:59 2013 +0200

    Fix removing nodes when chaining queries with scope by stringify where clause

commit d9b47ce8eb9f15671aacaaf805d8414c25cff560
Author: Thomas Schank <DrTom@schank.ch>
Date:   Wed Jul 3 08:19:11 2013 +0200

    Fix internal AR/Arel/rails bug by using class method for scope

    This fixes the numbers in the grouppermission of the filterpanel.
    There is yet a (similar?) bug that messes up the pagination.