Created
November 10, 2008 13:17
-
-
Save scharfie/23487 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ValidAttributes | |
def valid_attributes?(*args) | |
attributes = [*args].flatten.map { |e| e.to_s } | |
valid? || (errors.keys & attributes).empty? | |
end | |
module Errors | |
delegate :keys, :to => '@errors' | |
end | |
end | |
ActiveRecord::Base.send :include, ValidAttributes | |
ActiveRecord::Errors.send :include, ValidAttributes::Errors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment