An extension for the FriendlyId gem that allows scoping using a method (as opposed to a column name or relationship)
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
coverage
lib/friendly_id
spec
.gitignore
.rspec
.ruby-gemspec
.ruby-version
.travis.yml
Gemfile
MIT-LICENSE
README.rdoc
Rakefile
VERSION
friendly_id-method_scopes.gemspec

README.rdoc

FriendlyId::MethodScopes

Gem
Version Build Status Coverage Status

FriendlyId Extension to allow method scopes, in addition to column and relationship scopes

Installation

In your Gemfile:

gem 'friendly_id'
gem 'friendly_id-method_scopes'

Usage

In your model:

extend FriendlyId
friendly_id :name, use: [:slugged, :method_scopes], scope_methods: :custom_method_name

def custom_method_name
    # Code returning an array of eligible ids here
end

License

This project rocks and uses MIT-LICENSE.