Skip to content

Instantly share code, notes, and snippets.

@zxiest
Created April 14, 2011 11:31
Show Gist options
  • Save zxiest/919300 to your computer and use it in GitHub Desktop.
Save zxiest/919300 to your computer and use it in GitHub Desktop.
ActiveRecord fill
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