lib/loquor/representation.rb in loquor-0.0.2 vs lib/loquor/representation.rb in loquor-0.1.0

- old
+ new

@@ -1,17 +1,21 @@ module Loquor module Representation module ClassMethods - [:find, :where, :create].each do |proxy| - define_method proxy do |*args| - new.send proxy, *args + [:find, :find_each, :where, :create].each do |proxy| + define_method proxy do |*args, &block| + new.send proxy, *args, &block end end end module InstanceMethods def find(id) ApiCall::Show.new(self.class.path, id).execute + end + + def find_each(&block) + ApiCall::Index.new(self.class.path).find_each(&block) end def where(*args) ApiCall::Index.new(self.class.path).where(*args) end