README.md in superslug-1.2.0 vs README.md in superslug-1.3.0
- old
+ new
@@ -45,18 +45,21 @@
string. For example, if it is a hyphen, then `Hello World` becomes `hello-
world`. See below for an example.
* **force_update**: If `true`, the destination column (slug) will always be set
when the record is saved. Otherwise, it doesn't change once it is first
created, unless manually set.
+* **context**: If you pass a symbol of a `belongs_to` relationship, the slug
+ will only need to be unique within the association.
### Example
If you have a `Page` model that has a `name` and a `permalink` column, and you
-want to use underscore separators, then your model would look like this:
+want to use underscore separators, and only force the page slug to be unique within a category, then your model would look like this:
```ruby
class Page < ActiveRecord::Base
- has_superslug :name, :permalink, :separator => '_'
+ belongs_to :category
+ has_superslug :name, :permalink, :separator => '_', :context => :category
end
```
### Query Helpers