module FriendlyId::MethodScopes::Configuration

Attributes

scope_methods[RW]

Public Instance Methods

scope_method_columns() click to toggle source
# File lib/friendly_id/method_scopes.rb, line 41
def scope_method_columns
  [@scope_methods].flatten.map { |s|
    column = (method_foreign_key(s) or method_so_id(s) or s).to_s
    my_method = (method_foreign_key(s) or method_so_method(s) or s).to_s
    [column, my_method]
  }
end

Private Instance Methods

method_foreign_key(scope) click to toggle source
# File lib/friendly_id/method_scopes.rb, line 63
def method_foreign_key(scope)
  reflection = model_class.reflections[scope] || model_class.reflections[scope.to_s]
  reflection.try(:foreign_key)
end
method_so_id(scope) click to toggle source
# File lib/friendly_id/method_scopes.rb, line 51
def method_so_id(scope)
  if model_class.method_defined? scope
    :id
  end
end
method_so_method(scope) click to toggle source
# File lib/friendly_id/method_scopes.rb, line 57
def method_so_method(scope)
  if model_class.method_defined? scope
    scope
  end
end