Displaying 1 result from an estimated 1 matches for "association_primary_key".
2006 Mar 13
1
adding custom cache field
...ord
module Associations # :nodoc:
def self.append_features(base)
super
base.extend(ClassMethods)
end
module ClassMethods
def belongs_to_extra(association_id, options = { })
association_type = association_id.to_s + "_type" if association_id
association_primary_key = association_id.to_s + "_id"
if options[:total_cache]
module_eval(
"after_create ''#{association_type}.constantize.modify_value(\"#{self.to_s.underscore.pluralize + "_total"}\",#{association_primary_key},#{options[:...