module ActsAsStarable::StarerLib
Private Instance Methods
apply_options_to_scope(scope, options = {})
click to toggle source
# File lib/acts_as_starable/starer_lib.rb, line 14 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_starable/starer_lib.rb, line 7 def parent_class_name(obj) if obj.class.superclass != ActiveRecord::Base return obj.class.superclass.name end return obj.class.name end