module ActsAsFollower::FollowerLib

Constants

DEFAULT_PARENTS

Private Instance Methods

apply_options_to_scope(scope, options = {}) click to toggle source
# File lib/acts_as_follower/follower_lib.rb, line 16
def apply_options_to_scope(scope, options = {})
  if options.has_key?(:limit)
    scope = scope.limit(options[:limit])
  end
  if options.has_key?(:includes)
    scope = scope.includes(options[:includes])
  end
  if options.has_key?(:joins)
    scope = scope.joins(options[:joins])
  end
  if options.has_key?(:where)
    scope = scope.where(options[:where])
  end
  if options.has_key?(:order)
    scope = scope.order(options[:order])
  end
  scope
end
parent_class_name(obj) click to toggle source

Retrieves the parent class name if using STI.

# File lib/acts_as_follower/follower_lib.rb, line 9
def parent_class_name(obj)
  unless parent_classes.include?(obj.class.superclass)
    return obj.class.base_class.name
  end
  obj.class.name
end
parent_classes() click to toggle source
# File lib/acts_as_follower/follower_lib.rb, line 35
def parent_classes
  return DEFAULT_PARENTS unless ActsAsFollower.custom_parent_classes

  ActiveSupport::Deprecation.warn("Setting custom parent classes is deprecated and will be removed in future versions.")
  ActsAsFollower.custom_parent_classes + DEFAULT_PARENTS
end