Module: FriendlyId::SequelAdapter::SluggedModel
- Includes:
- FriendlyId::Slugged::Model
- Defined in:
- lib/friendly_id/sequel_adapter/slugged_model.rb
Defined Under Namespace
Classes: SingleFinder
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/friendly_id/sequel_adapter/slugged_model.rb', line 33 def self.included(base) base.one_to_many :slugs, :class => slug_class, :key => "sluggable_id", :conditions => {:sluggable_type => "#{base.to_s}"}, :order => "id DESC" def base.[](*args) if args.size == 1 SingleFinder.new(args.first, self).find or super else super end end end |
.slug_class ⇒ Object
48 49 50 |
# File 'lib/friendly_id/sequel_adapter/slugged_model.rb', line 48 def self.slug_class FriendlyId::SequelAdapter::Slug end |
Instance Method Details
#find_slug(name, sequence) ⇒ Object
52 53 54 |
# File 'lib/friendly_id/sequel_adapter/slugged_model.rb', line 52 def find_slug(name, sequence) slugs_dataset.where("slugs.name" => name, "slugs.sequence" => sequence).first end |