require 'redis' module Likeable mattr_accessor :facepile_default_limit self.facepile_default_limit = 9 ### Module Methods ### # ------------------ # class << self attr_writer :cast_id, :find_one, :find_many def classes (@classes||[]).flatten end def classes=(*args) @classes = args end # Likeable.model("Highlight") # ------------------------- # # turns a string into a model # "Highlight".constantize # => Highlight; "Hi1i6ht".constantize = #=> false def model(target_model) target_model.camelcase.constantize rescue NameError => ex return false end # Likeable.find_by_resource_id("highlight", 22) # ---------------------------------------- # # # id)} # like.find_many = lambda {|klass, ids| klass.where(:id => ids)} # end def setup(&block) yield self unless block.blank? true end end end