Last active
December 13, 2015 17:59
-
-
Save carlosantoniodasilva/4952387 to your computer and use it in GitHub Desktop.
Test AR monkey patch of define_attribute_methods.
This file contains hidden or 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
require 'active_record' | |
require 'active_record/base' | |
module ActiveRecord | |
module CVE123456 | |
def define_attribute_methods | |
# .... | |
raise "OMG Monkey Patch!" | |
end | |
end | |
end | |
ActiveRecord::Base.extend ActiveRecord::CVE123456 | |
# puts ActiveRecord::Base.define_attribute_methods | |
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") | |
ActiveRecord::Schema.define do | |
create_table :projects do |t| | |
t.string :name | |
t.text :description | |
end | |
end | |
class Project < ActiveRecord::Base | |
end | |
puts Project.new(name: "OMG") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment