Merge pull request #283 from morgoth/add-only-and-except-options-support

Add only and except options support
This commit is contained in:
Steve Klabnik
2013-05-05 12:00:59 -07:00
2 changed files with 56 additions and 5 deletions

View File

@@ -363,6 +363,8 @@ module ActiveModel
end
def include?(name)
return false if options.key?(:only) && !Array(options[:only]).include?(name)
return false if options.key?(:except) && Array(options[:except]).include?(name)
send INCLUDE_METHODS[name]
end