[rspec-users] Collection proxies need to be stubbed ?

Francois Beausoleil francois.beausoleil at gmail.com
Sun Jan 21 15:44:38 EST 2007


Shoot!  Message went away too fast.

has_many :projects
def active_projects
  self.projects.find(:all, :conditions => ['active = 1'])
end

Or another alternative:
class Project
  def self.active
    with_scope(:find => ['active = 1']) do
      yield
    end
  end
end

In the end, it boils down to preferences, no ?

Thanks !
-- 
François Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.org/


More information about the rspec-users mailing list