lib/toy/querying.rb in toystore-0.11.0 vs lib/toy/querying.rb in toystore-0.12.0
- old
+ new
@@ -7,22 +7,30 @@
if (attrs = adapter.read(id))
load(id, attrs)
end
end
+ alias_method :read, :get
+ alias_method :find, :get
+
def get!(id)
get(id) || raise(Toy::NotFound.new(id))
end
+ alias_method :read!, :get!
+ alias_method :find!, :get!
+
def get_multiple(*ids)
result = adapter.read_multiple(*ids.flatten)
result.each do |id, attrs|
result[id] = attrs.nil? ? nil : load(id, attrs)
end
result
end
alias_method :get_multi, :get_multiple
+ alias_method :read_multiple, :get_multiple
+ alias_method :find_multiple, :get_multiple
def get_or_new(id)
get(id) || new(:id => id)
end