more work on paginators

This commit is contained in:
albert
2011-06-21 14:32:07 -04:00
parent fab37bc0d3
commit 2f1fdcb459
16 changed files with 89 additions and 20 deletions

View File

@@ -2,6 +2,8 @@ class Favorite < ActiveRecord::Base
TABLE_COUNT = 100
belongs_to :post
scope :for_user, lambda {|user_id| where("user_id = ?", user_id)}
def self.model_for(user_id)
mod = user_id.to_i % TABLE_COUNT
Object.const_get("Favorite#{mod}")