Module: Vidibus::Permalink::Mongoid

Extended by:
ActiveSupport::Concern
Defined in:
lib/vidibus/permalink/mongoid.rb

Defined Under Namespace

Modules: ClassMethods Classes: PermalinkConfigurationError

Instance Method Summary collapse

Instance Method Details

Returns the current permalink object.



51
52
53
54
55
# File 'lib/vidibus/permalink/mongoid.rb', line 51

def permalink_object
  @permalink_object || if permalink_repository
    permalink_repository.for_linkable(self).where(_current: true).first
  end
end

Returns all permalink objects ordered by time of update.



58
59
60
61
62
# File 'lib/vidibus/permalink/mongoid.rb', line 58

def permalink_objects
  if permalink_repository
    permalink_repository.for_linkable(self).asc(:updated_at)
  end
end

Returns the defined permalink repository object.



44
45
46
47
48
# File 'lib/vidibus/permalink/mongoid.rb', line 44

def permalink_repository
  @permalink_repository ||= begin
    self.class.permalink_options[:repository] == false ? nil : ::Permalink
  end
end

Returns permalink scope.



65
66
67
# File 'lib/vidibus/permalink/mongoid.rb', line 65

def permalink_scope
  @permalink_scope ||= get_scope
end