lib/toy/querying.rb in toystore-0.8.0 vs lib/toy/querying.rb in toystore-0.8.1
- old
+ new
@@ -2,13 +2,12 @@
module Querying
extend ActiveSupport::Concern
module ClassMethods
def get(id)
- value = store.read(id)
- log_operation(:get, self, store, id, value)
- load(id, value)
+ log_operation(:get, self, store, id)
+ load(id, store.read(id))
end
def get!(id)
get(id) || raise(Toy::NotFound.new(id))
end
@@ -24,12 +23,11 @@
def get_or_create(id)
get(id) || create(:id => id)
end
def key?(id)
- value = store.key?(id)
- log_operation(:key, self, store, id, value)
- value
+ log_operation(:key, self, store, id)
+ store.key?(id)
end
alias :has_key? :key?
def load(id, attrs)
attrs && allocate.initialize_from_database(attrs.update('id' => id))
\ No newline at end of file