Sha256: 56fdcf74e0f9a3daba4428748611d907050944b5abef169a49c4711c31893dc7
Contents?: true
Size: 1.6 KB
Versions: 5
Compression:
Stored size: 1.6 KB
Contents
# # Copyright (c) 2006-2011 Hal Brodigan (postmodern.mod3 at gmail.com) # # This file is part of Ronin. # # Ronin is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ronin is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ronin. If not, see <http://www.gnu.org/licenses/>. # module Ronin module Model module Cacheable module ClassMethods # # Loads all objects with the matching attributes. # # @param [Hash] attributes # Attributes to search for. # # @since 1.0.0 # def load_all(attributes={}) resources = all(attributes) resources.each { |resource| resource.load_original! } return resources end # # Loads the first object with matching attributes. # # @param [Hash] attributes # Attributes to search for. # # @return [Cacheable] # The loaded cached objects. # # @since 1.0.0 # def load_first(attributes={}) if (resource = first(attributes)) resource.load_original! end return resource end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems