norman/friendly_id — pull request #588 by nneufeld (2014-07-10 17:20:43+00:00)
Title: Using :scoped with :history causes Unknown column '<table_name>.scope' when regenerating slug

If I have a model like this:

```ruby
class Restaurant < ActiveRecord::Base
extend FriendlyId
belongs_to :city
friendly_id :name, :use => [:scoped, :history], :scope => :city
end
```

The following will result in an ActiveRecord::StatementInvalid: Mysql2::Error: Unknown column 'restaurants.scope' exception:

```ruby
restaurant = Restaurant.new
restaurant.city = City.new
restaurant.name = "Joe's Diner"
restaurant.save

restaurant.title = "Bob's Diner"
restaurant.slug = nil
restaurant.save # throws exception(Unknown column 'restaurants.scope' )
```

This pull request fixes the offending where condition to use `friendly_id_slugs.scope`