norman/friendly_id — pull request #625 by eturino (2014-11-24 21:28:05+00:00)
Title: fix(Slugged+History+Scoped): fix SQL errors when using the 3 plugins together

`scope_for_slug_generator` method on not new records, with History and Scoped enabled, produced invalid SQL statements.

SELECT "restaurants".* FROM "restaurants" WHERE "restaurants"."city_id" = 1 AND ("restaurants"."id" != 1) AND (sluggable_id <> 1) AND "restaurants"."scope" = 'city_id:1'

SCOPE is part of the Slug model, not the Restaurant model:

SELECT "restaurants".* FROM "restaurants" WHERE "restaurants"."city_id" = 1 AND ("restaurants"."id" != 1) AND (sluggable_id <> 1) AND "friendly_id_slugs"."scope" = 'city_id:1'