Created
April 14, 2011 11:31
-
-
Save zxiest/919300 to your computer and use it in GitHub Desktop.
ActiveRecord fill
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 ActiveRecord | |
class Base | |
def fill(hash, ignore =[]) | |
b = self.getBinding | |
hash.each do |k,v| | |
if !ignore.include?(k) | |
#send(k + "=", v) | |
eval("#{k} = #{v}", b) | |
end | |
end | |
self | |
end | |
def getBinding | |
return binding() | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment