CilaCila A blogging framework for hackers.

Keep Finders on Their Own Model

| Comments

solution but needs your judgment

class User < ActiveRecord::Base
    has_many :memberships       def find_recent_active_memberships
        memberships.only_active.order_by_activity.limit(5)      end end
class Membership < ActiveRecord::Base       belongs_to :user        scope :only_active, where(:active => true)      scope :order_by_activity, order('last_active_on DESC')  end

Comments