Skip to content

Commit

Permalink
Adds note about find_by_attribute and array inclusion checking
Browse files Browse the repository at this point in the history
  • Loading branch information
nesquena committed Jul 12, 2011
1 parent 8e0dd2f commit ceb7de6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/yaml_record/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,13 @@ def reload
end

# Find YamlRecord instance given attribute name and expected value
# Supports checking inclusion for array based values
# Returns instance if found; false otherwise
#
# === Example:
#
# Post.find_by_attribute(:foo, "bar") => @post
# Post.find_by_attribute(:foo, "bar") => @post
# Post.find_by_attribute(:some_list, "item") => @post
#
def self.find_by_attribute(attribute, expected_value)
self.all.find do |record|
Expand Down

0 comments on commit ceb7de6

Please sign in to comment.